AActor::SetActorRelativeRotation
#include "GameFramework/Actor.h"
Access: public
Description
Sets the rotation of this actor's root component relative to its parent in the attachment hierarchy. There is also a FQuat overload for quaternion-based rotation.
Caveats & Gotchas
- • There is a second overload that accepts FQuat instead of FRotator — prefer the quaternion version in performance-sensitive code to avoid the FRotator-to-quaternion conversion.
- • Sweep during rotation can produce unexpected block results — UE sweeps the shape along the arc of movement which may touch geometry that a direct teleport would miss.
- • When the actor is unattached, relative rotation equals world rotation, matching the behavior of SetActorRotation.
Signature
ENGINE_API void SetActorRelativeRotation(FRotator NewRelativeRotation, bool bSweep=false, FHitResult* OutSweepHitResult=nullptr, ETeleportType Teleport = ETeleportType::None) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewRelativeRotation | FRotator | The new rotation of the actor's root component relative to its parent component (or world if unattached). | — |
| bSweep | bool | If true, sweeps to the destination rotation, stopping at blocking geometry. | false |
| OutSweepHitResult | FHitResult* | If provided and bSweep is true, receives the blocking hit. | nullptr |
| Teleport | ETeleportType | Controls whether physics velocity is preserved or recalculated. | ETeleportType::None |
Return Type
void Example
Rotate an attached actor to face along parent's X axis C++
// Zero out relative rotation so the actor aligns with its parent
SetActorRelativeRotation(FRotator::ZeroRotator); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?