Is There a Way for Me to Use a Timeline’s Update Node in a Framerate-Independent Manner?

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?

Can you show the code?

The whole point of a time line is that it doesn’t do this… :slight_smile:

The classic time line mistake is sample positions during the process. Current and destination should be calculated first, then enter the time line.

2 Likes

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.

Delta Time

2 Likes

So this is what I’m doing with the actor, in response to the player interacting with it:

And this is the timeline. First key has a value of 0, while the second has a value of -0.45:

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?

I’ve done that sort of thing inside Tick() functions before, but how would I do so outside of one over a specific span of time?

if you want to get a curve position in a framerate-independent manner then
you are not looking for a timeline. you look for just a curve float object:

image

image

image

image

image

2 Likes

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.

2 Likes

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 just had to read again to try understand what you want to do :slight_smile:

if your timeline goes for example from 0 to 45 (degrees)
then you dont have to use AddLocal Offset. you must use SetRelativeRotation

timeline will work ok no matter the framerate this way because you are not adding rotation, you are SETTING rotation

4 Likes

There’s your problem. Add local rotation. It should be Set relative rotation. :wink:

2 Likes

Okay, yeah, this is great! Thank you so much!

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?

1 Like