mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
mob fixes related to time and headYaw
This commit is contained in:
parent
0a36a67f78
commit
21d0530d39
9 changed files with 35 additions and 27 deletions
|
|
@ -35,14 +35,17 @@ class MobController
|
|||
|
||||
$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);
|
||||
$calcYaw = ($thetaOffset + $tan);
|
||||
$this->entity->yaw = $this->entity->headYaw = $calcYaw;
|
||||
}
|
||||
|
||||
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;
|
||||
$calcYaw = $tan + $thetaOffset;
|
||||
$this->entity->headYaw = $calcYaw;
|
||||
|
||||
$this->entity->yaw = $this->entity->headYaw = $calcYaw;
|
||||
|
||||
if($pitch){
|
||||
$diff = sqrt($x * $x + $z * $z);
|
||||
$calcPitch = rad2deg(atan($y / $diff));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue