Strangeness in RInterpTo

I have been working on a wallcrawling enemy recently and got all the base mechanics up and running great. When it came to what should be the easiest part (smoothly rotating the mesh to match the wall) I noticed some weird problems when using RInterpTo. It seems like it might be experiencing gimbal lock? When it gets a rotation that is just 90 degrees of what it was, it will seem to rotate ■■■■-eyed before lining up. And sometimes everything spins around strangely (watch gif below). Any idea how to fix this?

[video]https://imgur.com/a/umMFXHW[/video]

Here’s the code for the actual rotation (I tried directly rotating the mesh and the actor itself and not a scene component; same results):

It’s a common problem with rotations, it’s not a interp thing.

If you want to get rid of it once and for all, you need to switch to quaternions:

Interesting @ClockworkOcean. Is there an easy way to convert what I have to quaternions? Or some SLerp function for them?

I think you either need to re-write it in C++ or use:

Update on this to help anyone needing a BP solution.

Thanks to an article and a helpful youtube video, I managed to expose the UE4 quaternion functions I needed myself through a C++ class blueprint library, including UE4’s own Slerp function etc. No way I was paying $5 for basic functionality, no offense. Hopefully EPIC exposes these to BP in a later build so this won’t be necessary.

Resources:

@Capsu1 can you please elaborate? this tutorial is 2 years old and with 4.26 you can no longer “add C++ class” on a blueprint project :frowning:

@skybala
You can still add C++ classes fine in 4.26. They moved where the option is. It can now be found under File > Project.

Also, here is a tutorial specifically related to quat functions in BP: https://www.youtube.com/watch?v=KqbqZ3IY1II