Fix issue when finding direction with MathUtils when yaw < 0

This commit is contained in:
jglrxavpok 2020-04-29 21:37:20 +02:00
parent 7eee0c788f
commit 9e7f05c311
1 changed files with 1 additions and 1 deletions

View File

@ -30,7 +30,7 @@ public class MathUtils {
public static Direction getHorizontalDirection(float yawInDegrees) {
// +45f gives a 90° angle for the direction (-1° and 1° are towards the same direction)
int directionIndex = (int) ((yawInDegrees+45f) / 90f);
int directionIndex = (int) Math.floor(((yawInDegrees+45f) / 90f));
if(directionIndex < 0) {
directionIndex = Direction.HORIZONTAL.length-directionIndex;
}