tweaks to headYaw rotation, so it should be nearly perfect now

This commit is contained in:
GameHerobrine 2023-02-23 00:04:25 +03:00
parent a5a0c0e000
commit e4d1898613
5 changed files with 26 additions and 16 deletions

View file

@ -39,12 +39,16 @@ class Utils{
return $id;
}
public static function wrapAngleTo180_float($par0)
public static function wrapAngleTo360($angle)
{
$par0 %= 360.0;
return $par0 >= 180 ? $par0 - 360 : (($par0 < -180) ? ($par0 + 360) : $par0);
$angle %= 360;
return $angle < 0 ? $angle + 360 : $angle;
}
public static function wrapAngleTo180($angle)
{
$angle = fmod($angle+180, 360);
return $angle < 0 ? $angle + 360 : $angle - 180;
}
public static function getSign($v){
return $v > 0 ? 1 : ($v < 0 ? -1 : 0);
}