RealDocs

UKismetMathLibrary::Quat_UnrotateVector

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Rotates a vector by the inverse of Q, effectively transforming it from world space to local space. The inverse operation of Quat_RotateVector.

Caveats & Gotchas

  • Q must be a unit quaternion; the function does not normalize internally, so drift in Q will compound into direction error.
  • This is identical to calling Quat_RotateVector(Q.Inverse(), V) but avoids the explicit inversion step.

Signature

static UE_INL_API FVector Quat_UnrotateVector(const FQuat& Q, const FVector& V);

Parameters

Name Type Description Default
Q const FQuat& The quaternion representing the rotation to reverse.
V const FVector& The world-space vector to transform to local space.

Return Type

FVector

Example

Convert a world-space hit normal to actor local space C++
void AMyActor::OnHit(FHitResult Hit)
{
    FQuat ActorRot = GetActorQuat();
    FVector LocalNormal = UKismetMathLibrary::Quat_UnrotateVector(ActorRot, Hit.Normal);
    // LocalNormal is now relative to the actor's orientation
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.