USceneComponent::GetComponentRotation
#include "Components/SceneComponent.h"
Access: public
Description
Returns the component's world-space rotation as an FRotator. This is the fully composed rotation including all parent contributions, not the local rotation relative to the parent.
Signature
FRotator GetComponentRotation() const Return Type
FRotator Caveats & Gotchas
- • Returns world-space rotation. Use GetRelativeRotation() for the rotation relative to the parent.
- • Internally the transform is stored as a quaternion. GetComponentRotation() converts it to FRotator, which has gimbal lock near 90° pitch. Use GetComponentQuat() if you need the quaternion directly.
- • For pointing an actor or projectile in the component's facing direction, combine with GetForwardVector() rather than extracting Yaw manually from the FRotator.
Example
Get a component's world rotation C++
FRotator MuzzleRot = MuzzleComponent->GetComponentRotation();
FVector FireDir = MuzzleRot.Vector(); // forward vector from rotator See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?