AActor::K2_AddActorLocalRotation
#include "GameFramework/Actor.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Adds a delta rotation in the actor's local reference frame. Rotating around the local Z axis always spins the actor around its own up vector, regardless of its world orientation.
Caveats & Gotchas
- • bSweep has no effect for rotation — blocking hits during rotation are not detected. Do not check SweepHitResult after this call.
- • FRotator addition in local space can suffer gimbal lock. In C++, prefer AddActorLocalRotation with the FQuat overload for numerically stable rotations.
Signature
ENGINE_API void K2_AddActorLocalRotation(FRotator DeltaRotation, bool bSweep, FHitResult& SweepHitResult, bool bTeleport); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| DeltaRotation | FRotator | The change in rotation in the actor's local reference frame. | — |
| bSweep | bool | Whether to sweep (not currently supported for rotation — has no effect). | — |
| SweepHitResult | FHitResult& | Output hit result; will not be populated since sweep is unsupported for rotation. | — |
| bTeleport | bool | If true, physics velocity is preserved. If false, velocity is updated based on angular displacement. | — |
Return Type
void Examples
Spin the actor 5 degrees around its local up axis each tick
Blueprint
Rotate actor around its own up axis each tick C++
void AMyActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
FHitResult Hit;
K2_AddActorLocalRotation(FRotator(0.f, 90.f * DeltaTime, 0.f), false, Hit, false);
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?