Face pawn in direction of travel. Need critiques.


So I have a pawn that I use as a character. It has physics enables as it will be traveling in space. As you can see, when I press T, the pawn points towards its direction of travel but maintains its X (roll) axis orientation. I’ve used a timelime with 0-1 value, fed that into the MapRangeUnclamped to translate the 0-1 and then fed that into the RInterp to maintain the time it takes to set any rotation. It works perfectly but I suspect there is a simpler way to do this. I also wanted to make this a function after the timeline to keep the event graph as empty as possible.

Any insight would be much appreciated.

Try this

C++

float Speed = Velocity.Size();
if (Speed > 0.0f)
{
    FVector Direction = GetVelocity()->Velocity.GetSafeNormal();
    FRotator NewRotation = Direction.Rotation();
    SetActorRotation(NewRotation);
}

It works but snaps the pawn to the vector.

Yeah, and that is the purpose of this one :).
You can use this as desired rotation, and interpolate all the values, apart from X.

I tried that, it worked one time, then snaps rotation again.