Lerp not working as intended (SOLVED)

Hello. I have made a simple drawer, and I am trying to make it open and close. I have found a tutorial for this, and made a simple timeline set up as can be seen in the pictures bellow, exactly like in the tutorial.

However there is a problem with the lerp. In the video the first blueprint made it so that the drawer would move my 90 on X from its current position. However for me, the blueprint moves the drawer to coordinates 90,0,0. Any idea why this is a thing, or a different way to achieve the same result?

Thank you in advance

SO I have managed to get that to work by adding another GetRelativeLocation node, splitting it connecting the Y and Z but the problem now is, I have added a rotated version of this, and i need to change the X value but only for the rotated version. I have tried getting the relative location and than + 2 but for the rotated version it made it go backwards instead of forwards to open the drawer.

Any idea how I can make each drawer open in the right way no matter the rotation?

When you work with Timelines, it’s easy to accidently interpolate twice. The TL is already sampling the necessary data; if you now plug in relative into A, you’ll get inconsistent results. Either prepare the data before the TL starts or use fixed values.

My drawer’s default X is 5 and it extends to 35, try it like so:

Note (upper left) how the Drawer is parented to the Shelf. With this setup, you can rotate the whole actor however you want and use relative X of the Drawer:

The timeline is a 0-1:


If your actor’s hierarchy is more complex, you may need to share how it’s set up. You can transform directions from local to world if necessary. Think of a robotic arm with 4 joints and a bunch of pistons - something is always relative to something else.

1 Like

Hello. First thank you for your answer and all the screenshots/video I appreciate that.

However for some reason, this isn’t working for me. You can see what I did here, and I might just be silly and made some mistake, but there are two issues.

So first I set the A X value to what the value is at the start. And than the B value is the value where I want it to extend to. That is working beatifully however because I left the two other values at 0, the shuffle moves to Z and Y location of 0 and 0 which is not what I want. I cannot set them manually because they are different for each drawer of course

And second problem is that for some reason it is still not moving in the correct direction when rotated, but instead backwards. Now in this case I have no idea where the issue might be, and so I have provided the screenshots of my blueprints. I also provided my Character Blueprint to see how my action is being called, but I don’t think that will help with anything.

Character Blueprint
Character Blueprint Part 2

Drawer Blueprint:

You’re mixing up world coordinates with relative coordinates. If the example I suggested is somewhat close to what you’re trying to achieve, consider replicating it more closely.

1 Like

I got it working!

So the problem was the drawer itself was a Root Component of that blueprint, meaning that it would always change the world location, so I removed the component, readded it as a child of the Default Scene Root, got it to move forward always with the help of your blueprint and now it’s working. Thank you for your help, I spent a long time working on this thing haha

1 Like

Yup, make sense - if you attempt to relative move the root and it’s not attached to anything else (like another actor / comp) Unreal will treat this relative as if it was world.