libgdx / gdx-ai

Artificial Intelligence framework for games based on libGDX or not. Features: Steering Behaviors, Formation Motion, Pathfinding, Behavior Trees and Finite State Machines
Apache License 2.0
1.18k stars 241 forks source link

Fixed a bug because % doesn't behave like mod with negative numbers. #39

Closed ghost closed 9 years ago

ghost commented 9 years ago

It cause reach orientation to choose the long rotation over the short rotation under some circumstances.

davebaol commented 9 years ago

Thanks, you're right. :+1: Just added the method wrapAngleAroundZero to the ArithmeticUtils class that fixes this issue without using the double modulo which is somewhat expensive. Apart from rounding errors, it should yield the same results.

ghost commented 9 years ago

No problem. I'm using extensively this library and it's really great. Unfortunately, I extend your library using Scala so I'm not able to contribute a lot :/