Hey everyone, I have a questions for people who are good at math…
So I have this simple rotation overtime of my character as shown in the SS below.
My question: Sometimes the player rotates the other way around itself to reach the rotation instead of finding the shortest rotation distance. How do I make it so the character only rotates the shortest amount possible. For example, if two look at points are next to each other, the character doesn not need to spin around itself to look at the other position, he could just spin the other way instead and would look more realistic.
One is, that the engine likes to jump from -180 to 180 or the other way around, without warning. You can get around this, by either using Quaternions, or on only adding and subtracting local rotation.
Problem two is your code ( sorry ) With timelines and lerps, you need to calculate the start and end points before going into the timeline. You’re recalculating them during the timeline, which will lead to all sorts of weird shenanigans.
For other people that might be wondering, it does not need to be on the event tick to work, if you set the focus of the AI to the actor in the behavior tree afterwards.