To animate a lever as though it’s been pulled, I created a timeline in BP that adds a local rotation to the level via the timeline’s Update node. But since that node executes every frame, the lever does not travel the same distance at lower/higher framerates. The timeline’s length is 1 and there are only two keys: one at 0 seconds and another at 1 second.
So I’m wondering how I can have the same kind of smooth rotation in a way that’s not affected by framerate. Can anyone help me with that?
Normally you multiply an additive value by delta time to make the value framerate independent.
Sounds like you want to just want to interpolate to a rotation value instead of using additive values per frame.
But I’m having trouble picturing your suggestion in my head. Do you mean I should store the actor’s starting rotation in a variable, and then create another that has the target rotation? How would I transition between the two inside a timeline?
Well since you are running this on Update (every frame), multiply its float pin HandleYRotation by world delta seconds before attaching it to input DeltaRotationY.
I think I’ve misunderstood your instructions. Using an “In Time” value of 0 resulted in no rotation, and a value of 1 resulted in an instant rotation. How would I use a curve to gradually move the actor’s rotation, over the span of that one second?
Unfortunately, this resulted in nothing happening. I also tried adding the HandleYRotation output to HandleYRotation * DeltaTime, but that just led to the actor rotating based on the framerate again. Is there something else I should try?
I tried the Set Relative Rotation node early on, but it wasn’t working because I didn’t account for a -90° rotation that the lever starts with on its x-axis. But your guidance helped me realize that and now the timeline-led rotation is framerate-independent like it should be.
Something I’m now been wondering is: in what sorts of circumstances would it be preferable to have framerate-dependent logic? To my understanding, animation frame data is a core part of balancing for fighting games, but what else is there?