mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Avoid direct mutations of Entity->location
This commit is contained in:
@ -253,8 +253,10 @@ abstract class Projectile extends Entity{
|
||||
|
||||
//recompute angles...
|
||||
$f = sqrt(($this->motion->x ** 2) + ($this->motion->z ** 2));
|
||||
$this->location->yaw = (atan2($this->motion->x, $this->motion->z) * 180 / M_PI);
|
||||
$this->location->pitch = (atan2($this->motion->y, $f) * 180 / M_PI);
|
||||
$this->setRotation(
|
||||
atan2($this->motion->x, $this->motion->z) * 180 / M_PI,
|
||||
atan2($this->motion->y, $f) * 180 / M_PI
|
||||
);
|
||||
}
|
||||
|
||||
$this->getWorld()->onEntityMoved($this);
|
||||
|
Reference in New Issue
Block a user