So what I want to do seems really simple, yet what I’m trying is just not working.
I have four points and one actor, I just want the actor to rotate SMOOTHLY between the points. For some reason it just freaks out and jumps all over the place. I have also tried to use rinterp with getworlddeltaseconds connected and it does not work either.
I am sure there is a simple solution to this, but I’m dumb.
Any help would be greatly appreciated.
First of all, you are not dumb. We all gotta start somewhere.
So before the solution, remember two things when using Lerp and Timelines:
- If you plan to repeat the Timeline, use Play from Start, not Play to allow a reset each fire.
- When you lerp a rotation, dont use GetWorldRotation ever! why? because you are updating the rotation each time the lerp fires and the GetWorldRotation is not lerping correctly. If im rotated 0.0.0 and you want me to rotate to 0.0.90 you say, with lerp, take me from point A to point B. A and B are not dynamic, you want from 0.0.0 to 0.0.90. if you use GetRotation you are saying, each fire of Lerp, take me from NEW A to OLD B and it will simply not work the way you want. So to prevent this from happening, always SAVE actor’s rotation before lerping
So here is the full solution:
You simply use an Index and increment it after each rotation until no more points are left.
it will look like this:
All the best and good luck with UE4
This was exactly what I needed! Thank you so much for your help!
So I noticed with my current timeline set up, it actually doesn’t rotate to the correct position. How should I have my timeline set up to fix this?
Create a Float track and add 2 points:
- Time: 0.0 Value: 0.0
- Time: Duration you want for turning. Value: 1.0
Simply hook the Float output to Lerp’s alpha
Let me know if it helped
yeah, that is how I set it up unfortunately.
So it’s doing something really weird, if I plug in all the same points, it actually goes back and forth between two points. What would cause this?
Can you post a screenshot of your blueprint?
The only reason this problem would happen is because of “Shortest Path” boolean in “Lerp(Rotator)”. If two points are really close to each other and you want the player to rotate RIGHT for more than 180 degrees, it will instead go LEFT to take the shortest path and it would seem like it is going back.
Other than that, your code seems fine
Very cool, thank you for all your help, I really appreciate it!