Finding the shorter turning direction towards a target
- by A.B.
I'm trying to implement a type of movement where the object gradually faces the target. The problem I've run into is figuring out which turning direction is faster. The following code works until the object's orientation crosses the -PI or PI threshold, at which point it will start turning into the opposite direction
void moveToPoint(sf::Vector2f…