mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
jump test for pathfinder
This commit is contained in:
parent
d0ec32dc02
commit
dd4264998d
5 changed files with 28 additions and 15 deletions
|
|
@ -33,14 +33,14 @@ class MobController
|
|||
$dx = $d->x;
|
||||
$dz = $d->z;
|
||||
|
||||
$tan = $dz == 0 ? ($dx < 0 ? 180 : 0) : (90 - rad2deg($dx / $dz));
|
||||
$thetaOffset = $dz <= 0 ? 90 : 270;
|
||||
$tan = $dz == 0 ? ($dx < 0 ? 180 : 0) : (90 - rad2deg(atan($dx / $dz)));
|
||||
$thetaOffset = $dz < 0 ? 90 : 270;
|
||||
$this->entity->yaw = $this->entity->headYaw = ($thetaOffset + $tan);
|
||||
}
|
||||
|
||||
public function lookOffset($x, $y, $z, $pitch = true){
|
||||
$tan = $z == 0 ? ($x < 0 ? 180 : 0) : (90 - rad2deg(atan($x / $z))); /*arctan(infinity) = pi/2 = (90deg) - 90 = 0*/
|
||||
$thetaOffset = $z <= 0 ? 90 : 270;
|
||||
$thetaOffset = $z < 0 ? 90 : 270;
|
||||
$calcYaw = $tan + $thetaOffset;
|
||||
$this->entity->headYaw = $calcYaw;
|
||||
if($pitch){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue