Player rotation alignment, rinterp to issue

Hi, Unity refugee here and having a blueprint struggle. I’ve seen some similar issues but I can’t find a fix, or wondering what I’ve missed.

I’ve wanted to align my character rotation to the surface. So when riding slopes/ramps it matches the angle. This is all working fine.

However, I want to smooth this rotation so it doesn’t snap instantly to position. When I add the rinterp to node, and increase the Interp Speed, instead of smoothing this rotation it reduces the angle depending on the value. Also at higher values add some stutter.

The picture shows with Interp Speed set to 0 (matching angle of ramp) and then interp speed at 10 (reduced player angle).

Sorry if it’s dumb but I’ve tried so many different things and scratching my head! Would really appreiciate any wisdom.



Hey @HJJallday!

Have you tried using a lower value? You may want to try something more like .5 or 1, I’m not sure of the exact math inside but I want to say the higher it is, the slower it goes? You have to play around with nodes like that sometimes.

Try out those lower values and see what happens- But what I feel like is happening is it’s just rotating extremely slowly and not quite getting there due to the curve you’re creating by accident making it bottom out in terms of rotation speed- getting “slower” because the difference keeps getting smaller and smaller- but the speed of change staying the same.
I’d even try .1 :slight_smile:

Hi, thanks for you response. I initially thought it was that also. However it never reaches the angle, so it’s not going slow it’s just getting stuck.

At low values there is hardly any rotation and noticeable stutter on the character. At high values (15+) the angle is correct and the stutter is gone, but there is hardly any noticeable easing.

I have tried a bunch of things, isolating the different rotation vectors, using a different nodes. But no luck yet.

Hey again @HJJallday!

This is because you’re getting current value and telling it to go to a new value- every single tick. It CAN’T reach the end. It will keep slowing down forever. But I see what you’re saying.
For reference
0 to 100 at speed of ten:
Tick 0: Current pos: 0
Tick 1: Current pos: 10
Tick 2: Current pos: 19
Tick 3: 27.1
Tick 4: 34.39
Tick 5: 40.951
Tick 6: 46.8559

So as you notice the interval gets smaller and smaller and can never truly reach the end.

HOWEVER it SHOULD eventually reach a 99.9999/100 state. Higher values mean higher speed of easing. The thing you need here is a single input and single output…

What about this?

Instead of setting world rotation every tick, start the game with Beginplay doing exactly what you have here- cast straight down, get impact normal. SAVE that value as a variable, so now you have a starting slope angle.

Then, on tick, grab your impact normal like you’re already doing, and compare your saved one to this new one. IF it is Equal- bypass it and move on.
IF IT IS NOT EQUAL- Make a custom event to run that will do the rotation, because this needs to happen ONCE, not continuously. The rInterpTo is fine here! You just need to keep it from CONSTANTLY updating because the old variable is being shifted before it’s done and messing up the rInterpTo’s math.

Then you just need to check in tick for if the goal value changes- and then you just start that Custom Event again. Because the thing is, you should ONLY have to do that rotation when the value of the slope changes, not constantly, right? :slight_smile:

Thank you so much for this. Really appreiciate you taking the time. That totally makes sense. When I tried other ways such as changing to an ease node, that is what happened. Fast movement initially then gradual slowing. I will implement asap and let you know how I get on. Thanks again!

1 Like

Sorry I forgot to reply once this was solved. The issue was with the delta seconds. The code actually works fine. Not sure why but when I saved the delta seconds as a float then plugged it in rather than direct from the tick it worked fine.

Also great advice to change it so it only reads when angle changes rather than always on tick, thanks @Mind-Brain

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