Actually fix issue direction issue with yaw < 0

This commit is contained in:
jglrxavpok 2020-04-29 22:07:37 +02:00
parent 9e7f05c311
commit 1cb8166edd
1 changed files with 1 additions and 0 deletions

View File

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