How do I consistently know which direction the character will pivot when orienting to movement

I have figured out how to determine if the character will rotate left or right when orienting to movement, but not if the character is doing a complete 180 degree turn. This is my script.

What is a more reliable method for knowing if your character will turn right or left when orienting to movement?

The problem with this approach is that you relay on the Velocity to be different from the character facing direction (which of course is not the case when you start running backwards or if your character has instantaneous turning)

I would suggest:

  1. On Begin Play: Store the Actor Forward Vector
  2. Each Tick (or whenever you need the change): get a new Actor Forward Vector and check the angle between that and the stored vector.
  3. Consider the case where there is 0 difference (currently it will return Right if there is no actual movement)
  4. Store the new Actor Forward Vector to compare to the one you’ll get next time you check.

With this approach you might not check on each frame but for sure you will have to store the Forward vector each tick just in case you happen to need it on the next. You will also need to make sure that the storing of the Forward Vector happens after the check.