Lerping Rotation not respecting Timeline

Hi All,

I’m having an issue with this code. I have 3 spring arms on my character. One in top position, one in back position and the main one I have my camera on. On certain conditions I want to blend my main spring arm between the back position (this is the default) to the top position - and back again. I’m doing this using a timeline and lerping rotation to match one of the other two spring arms.

Everything works fine, except the Lerp doesn’t respect the Timeline. My Timeline is set to a length of 3 seconds and linear values 0,0 ; 3,1. So it goes from 0 to 1 in 3 seconds.

However, my spring arm lerps to the target (top or back) spring arm in around 0.5 seconds regardless of how I setup my Timeline. My Timeline will still run for 3 seconds though.

Any idea with what’s wrong with my code here?

Many thanks!!

Lerps work by taking in two fixed points. You’re feeding them points that are changing in realtime, which will mean you get very weird animations.

1 Like

Thank you for the response! I guess that makes sense, although this (Timeline → Lerp) is how I saw a smooth transition between moving cameras done on a youtube tutorial. Any recommendation on how to smoothly move between two camera positions in real time in a smooth fashion?

You need to store the initial rotation in a variable before the TL kicks in and does its thing:

Otherwise you’d interpolate twice and things will be inconsistent. The rest can stay as is.

This is super helpful. Thank you for making the time to share. I’ll try this out.

Yes, timeline → lerp, but the lerp has fixed start and end points :slight_smile:

Just want to confirm this works great (and say thank you to you both!). I needed to put a variable for both the start and end points for it to work properly. Leaving here for future searches if others come across this issue.

1 Like