How to use Lerp Rotator in C++?

I would like to learn how to implement Lerp Rotator using C++? and how to set the Shortest Path to true in it.
Thank You.

blueprint:

3 Likes

It’s explained quite simply and clearly on this post:

Hope this can help :slight_smile:

3 Likes

FRotator NewRotation = FQuat::Slerp(Rotation1.ToQuat(), Rotation2.ToQuat(), Alpha);

for me this is not working, it says no suitable user found for conversion from rotator to fquat

FRotator NewRotation = FQuat::Slerp(AltReleasedRotation.ToQuat(), AltPressedRotation.ToQuat(), Percentage, true);

this is what I am trying to do. I also need to set the Shortest Path to true

FQuat::SLerp function is shortest path, so you’re on the right track. Non-shortest path is FQuat::SlerpFullPath.

The no suitable user found for conversion from frotator to fquat problem comes from the fact that you’re assigning to a FRotator variable a FQuat value (which comes from FQuat::Slerp).

You should construct a rotator from the quat like this FRotator NewRotation = FRotator(FQuat::Slerp(Rotation1.ToQuat(), Rotation2.ToQuat(), Alpha));

3 Likes