Download

[Question + Example] Smooth Animation Transitions

Hi guys,

I’m working on some fanciness today. Previously our character would ‘snap’ to an animation and movement speed with a button was pressed – i.e. if you were walking and you hit the sprint button, the character would instantly go from 200 speed to 600 and the animation would instantly change from walk to sprint. My goal today was to implement smooth transitions between movement modes - change speed over time.

I’ve successfully accomplished this with sprinting and walking, but crouch walking is giving me a bit of an issue.

The crouch animation is jittering like crazy, and I strongly believe it’s because the Max Walk Speed is never hitting exactly 80.0. I think because its being adjusted by (Delta Seconds * 600) it’s probably giving a float in return that might or might not actually be near 80. It could be bouncing between 78.3 - 82.7 (or 79.9 - 80.1) constantly. My question isn’t really about “what’s wrong”, but more about “how would you go about clamping this formula so that as it approached 80 it would rest exactly on 80.0?

I was trying the same thing earlier , Tesla has a tutorial about this in his youtube channel named “Blend Walk_Run” , which shows how to do what you already done, “walk to sprint” and reverse by using “Timeline” Node .
I was trying to apply that technique to other states like idle to walk , but i couldnt actually make it to work , and i forgot about it !
So i’d like to know how to do this as well . cheers :slight_smile:

Wow I somehow completely forgot about the timeline node!

I have absolutely no legitimate reason for saying this, but I don’t like timeline nodes. I think they look at me funny.

Anyways I’m pretty sure I found my own solution (bathroom breaks are great for that, aren’t they?)

I’ll post an update if I get it working.

Alright, I got it working. With my setup, I needed to check if the asset was decreasing or increasing, then if it was, check to see if it broke past 80 (either higher or lower depending on which direction you were coming from). If it did, set it to 80. If not, continue.

If timelines haven’t personally wronged you in the past, and you don’t have an unreasonable grudge against them, I’d use timelines instead of my setup.

Edit: My nodes look like a spaceship!

Looks great , i’ll give it a go as soon as i get home .