mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-09 13:14:54 +00:00
Fixed double physics calculation
This commit is contained in:
parent
98dd7f8c15
commit
fc62c91c90
@ -716,7 +716,7 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
if($this->inBlock){
|
if($this->inBlock){
|
||||||
$this->boundingBox->offset($dx, $dy, $dz);
|
$this->boundingBox->offset($dx, $dy, $dz);
|
||||||
$this->x = ($this->boundingBox->minX + $this->boundingBox->maxX) / 2;
|
$this->x = ($this->boundingBox->minX + $this->boundingBox->maxX) / 2;
|
||||||
$this->y = $this->boundingBox->minY + $this->height;
|
$this->y = $this->boundingBox->minY/* + $this->height*/;
|
||||||
$this->z = ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2;
|
$this->z = ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2;
|
||||||
}else{
|
}else{
|
||||||
//$collision = [];
|
//$collision = [];
|
||||||
@ -731,7 +731,7 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
$oy = $this->y;
|
$oy = $this->y;
|
||||||
$oz = $this->z;
|
$oz = $this->z;
|
||||||
|
|
||||||
if($this->isColliding){ //With an entity
|
if($this->isColliding){ //With cobweb?
|
||||||
$this->isColliding = false;
|
$this->isColliding = false;
|
||||||
$dx *= 0.25;
|
$dx *= 0.25;
|
||||||
$dy *= 0.05;
|
$dy *= 0.05;
|
||||||
@ -892,9 +892,15 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->x = ($this->boundingBox->minX + $this->boundingBox->maxX) / 2;
|
$pos = new Vector3(
|
||||||
$this->y = $this->boundingBox->minY + $this->height;
|
($this->boundingBox->minX + $this->boundingBox->maxX) / 2,
|
||||||
$this->z = ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2;
|
$this->boundingBox->minY/* + $this->height*/,
|
||||||
|
($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2
|
||||||
|
);
|
||||||
|
|
||||||
|
if(!$this->setPosition($pos)){
|
||||||
|
$this->boundingBox->setBB($axisalignedbb);
|
||||||
|
}
|
||||||
|
|
||||||
$this->onGround = $movY != $dy and $movY < 0;
|
$this->onGround = $movY != $dy and $movY < 0;
|
||||||
$this->updateFallState($dy, $this->onGround);
|
$this->updateFallState($dy, $this->onGround);
|
||||||
@ -911,15 +917,6 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
$this->motionZ = 0;
|
$this->motionZ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->boundingBox->offset($dx, $dy, $dz);
|
|
||||||
$this->x += $dx;
|
|
||||||
$this->y += $dy;
|
|
||||||
$this->z += $dz;
|
|
||||||
|
|
||||||
$cx = $this->x - $ox;
|
|
||||||
$cy = $this->y - $oy;
|
|
||||||
$cz = $this->z - $oz;
|
|
||||||
|
|
||||||
//TODO: vehicle collision events (first we need to spawn them!)
|
//TODO: vehicle collision events (first we need to spawn them!)
|
||||||
|
|
||||||
Timings::$entityMoveTimer->stopTiming();
|
Timings::$entityMoveTimer->stopTiming();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user