using interpolation for a climbing mechanic

Hello, I’m trying to create a simple climbing system from scratch. I’m a beginner and needed some help.

I’m using ‘Add actor local offset’ node which updates the actor location upwards, I wanted to add interpolation to it so it goes smoothly. Since right now it’s moving too quickly and the climbing animation has not enough time to play (in the state machine).

here’s what it looks like so far, you can see the animation is playing after the offset was added because its too fast (there’s no interpolation):

can anyone help me figure out how I could go about adding interpolation?
thank you for any replies

Hey @str4w_b3rrieZ

According to your “AddActorLocalOffest”, your moving the character 2.5 meters up and 1 meter forward or to the right in one frame.

Usually for climbing systems you would first calculate the actual distance to the target ledge, horizontal and vertically, then add the desired offset from the ledge to that calculation.

That been said, you have 2 ways to approach this.

1 - Use root motion and IK in your animation to let the animation handle the process of moving the character. This is usually smoother and accurate if done correctly, but requires a little bit more work.

2 - Use something like a Timeline to lerp from the starting location to the target location.
This may require using different curves for vertical and horizontal displacement, but allows you to have full control over how long it takes for the whole process to complete.

Whatever method you choose, it’s recommended to first move the character to the correct position. Changing its location and rotation to face the ledge at the desired distance.

If you’re only climbing to fixed ledges, is probably best to use root motion as GRIM_Warlock said.

Motion Warping might be useful here to smooth it out.

If you’re going for some sort of freeform climbing or ladders with an arbitrary height, you might want to try setting movement mode to flying (or a custom mode with no gravity), then use add movement input instead off offset loc, and let the movement component handle the interpolation.

Thank you for your reply.

I found a tutorial, is this what you may be referring to? https://www.youtube.com/watch?v=eUeHhh4ZuEw I wanted to double check because I’m going to try and implement this by making my own animations instead of using mixamo.

So I have tried something like this but got stuck pretty quickly as I had no idea what to put for the target position (B), because won’t that position always be different depending on if I’m climbing in several different locations? (I know I may need some calculation but I’m not sure what/how)

I apologize for my lack of knowledge again as I’m a beginner in this subject, so please could you go into greater detail on how I could carry out the steps to achieve what you’re talking about? I have read up on a lot of what you’re talking about, but it seems I’m not sure how to apply it on my own :slight_smile:

Do you have a class made for climbable obstacles? If so, add an arrow component or something to it which indicates the target location. Then when you overlap or linetrace to obstacle for interaction event, use a get component by class to find the arrow and pass its transform to your climb code.

Not only is this a quick cheat to grab the target loc, the arrows will make it easier to see where climbing goes in the editor.

1 Like

Thank you for your replies!

Just checking is this what you mean by ‘use root motion’? I found a tutorial on it: https://www.youtube.com/watch?v=eUeHhh4ZuEw I didn’t know this was possible so I will be trying it.

This sounds like a smart idea, I will try it as well as the root motion thing, I will let you know the outcome if it works for me :slight_smile:

Thanks again

Yes, that vid goes over the core of root motion. Also check out the Motion Warping doc link from previous post. Motion warp allows for more control of where a root motion anim ends up at.

As for the arrows, I use a similar trick for sliding and snapping characters to furniture objects. Is easier than getting locations and doing offset math every time a char tries to use something lol.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.