AActor::GetActorQuat
#include "GameFramework/Actor.h"
Access: public
Specifiers: inline
Description
Returns the rotation of the actor's RootComponent as a quaternion. Prefer this over GetActorRotation when doing math that chains rotations, as FQuat avoids gimbal lock and is faster to compose.
Caveats & Gotchas
- • Returns FQuat::Identity if the actor has no RootComponent — always ensure the actor is properly initialized before calling this.
- • The returned quaternion is in world space; for a local-space quaternion relative to a parent, query the RootComponent's relative transform directly.
Signature
inline FQuat GetActorQuat() const Return Type
FQuat Example
Compose rotations using quaternions C++
FQuat ActorQuat = MyActor->GetActorQuat();
FQuat DeltaRot = FQuat(FVector::UpVector, FMath::DegreesToRadians(45.0f));
FQuat NewQuat = ActorQuat * DeltaRot;
MyActor->SetActorRotation(NewQuat); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?