RInterp To doesn't seem to interpolate my pawns rotation. What am I doing wrong?

I’m currently trying to set up a pawn, not a character blueprint, to move along the Y and Z axis and rotate in the direction it’s moving by a maximum amount of degrees. Think Star Fox, essentially.
I seem to have managed to get the movement down, it accelerates and decelerates just fine, so VInterp To is working as expected.

However, the issue is with “RInterp To” when attempting to apply the rotation. Instead of smoothly interpolating from the current rotation to the desired rotation it simply snaps to the target rotation and seems to be clamped based on the interp speed for some reason.

Here’s the current setup I’ve got for the rotation part. (I plan to tidy it up properly when everything is working as expected.)
PlayerPawn is declared at BeginPlay and simply sets the Pawn with “Get Player Pawn”. Not sure how necessary it is but made sense to me and has worked so far.

I’ve tried setting the Interp speed to different values but it keeps snapping. I’ve also tried out some different means to fetch the current rotation in case I was doing something wrong there but no luck. I have no idea what I might be doing wrong here, could someone lend a helping hand?

For reference, my Pitch/Yaw/Roll are set to be at 45 degrees, which works just fine if I don’t put it into the RInterp To. However…here’s the result with the current setup:

interpbug

As you can see, it’s neither interpolating smoothly, nor does it go to 45 degrees at all. Printing it says it goes to 10.75…? (This increases with Interp Speed but again, no smoothing.)

Thank you for taking your time to read, any help is appreciated!

Did you mean to take X here?

1 Like

Thank you for the reply!
No, it’s meant to apply Roll rotation when I go sideways/horizontally hence the y-direction.

With that said, I did manage to solve my issue but I don’t understand why it’s working differently.
Adding a “Current rotation” Rotator variable that is being set worked and it’s not interpolating smoothly; as so:


Don’t mind the Ease function I used instead, RInterp To worked fine too, I just liked Ease better after testing.

However, I can’t really wrap my head around as to why this is functionally different from simply getting the player pawns current rotation as the current rotation and setting it in the Set Actor Rotation (which causes the snapping as in the Gif I posted).

interpfix
Here’s what I was expecting initially, but again, I have no idea why or what is actually different. As long as it works though, I guess?

1 Like

Cool, that you did solve the problems.

Just a guess what might have happened. Blueprints can have really surprising impacts. That’s because of their execution being run backwards. So execution might happen multiple times, which can lead to unexpected results and also costs performance. Here’s an image showing what I mean (sorry for bad quality)

Promoting results to variables, as you did, is one of the solutions to avoid such issues. So this might be the case in your BP as well, did not look deeper into it.

Also, using functions is helpful. Within functions, instead of nesting more and more functions, use promote to LOCAL variables to reduce execution counts within the function. Variables in blueprints remain active but local variables used in functions are removed after function is run.

EDIT: there had been a nice tutorial on youtube on BP math optimiziation, which expained that stuff, unfortunately I checked this again but this one is marked private now…

1 Like

Oooh, I was not aware it runs backwards. Fair enough, thank you!
I’ll turn them into functions now that it mostly works as I want it to. Good to know about the optimization!