Beginner How do i Invert a Vector or a Rotator?

When my Pawn moves backwards I want the character’s body to face in the opposite direction to which is being pushed on the left stick. In UDK I simply used to invert the pawn’s velocity like so:


Pawn.FaceRotation(RInterpTo(Pawn.Rotation, Rotator(-Pawn.Velocity), DeltaTime, LegsRotationSpeed, true), DeltaTime);

but I’m having trouble working out how to do that in C++. So was thinking of just inverting the vector or rotator I’m using to move the pawn like so:


MyCharacter->SetActorRotation(FMath::RInterpTo(pPawnRot, RunningRotationVector.Rotation(), GetWorld()->GetDeltaSeconds(), LegsRotationSpeed));

but I don’t know how to invert it.

any help please?

Hey, give this a try.



MyCharacter->SetActorRotation(FMath::RInterpTo(pPawnRot, FRotator(-MyCharacter->GetVelocity().Rotation()), GetWorld()->GetDeltaSeconds(), LegsRotationSpeed));