AActor::K2_SetActorRelativeTransform
#include "GameFramework/Actor.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Sets the actor's full transform (location, rotation, and scale) relative to its parent in one call. If the actor has no parent, the transform is applied in world space.
Caveats & Gotchas
- • When the actor has no attachment parent, this behaves identically to K2_SetActorTransform — the 'relative' distinction only matters within an actor hierarchy.
- • In C++ prefer SetActorRelativeTransform, which uses ETeleportType and an optional FHitResult pointer.
Signature
ENGINE_API void K2_SetActorRelativeTransform(const FTransform& NewRelativeTransform, bool bSweep, FHitResult& SweepHitResult, bool bTeleport); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewRelativeTransform | const FTransform& | The new transform relative to the parent actor (or world if unattached). | — |
| bSweep | bool | Whether to sweep during the translation portion. | — |
| SweepHitResult | FHitResult& | Output hit result populated when bSweep is true and a blocking hit occurs. | — |
| bTeleport | bool | If true, physics velocity is preserved. If false, velocity is updated based on displacement. | — |
Return Type
void Example
Snap a child actor to a specific relative transform C++
FTransform RelTransform(FRotator(0.f, 45.f, 0.f), FVector(0.f, 200.f, 0.f), FVector(1.f));
FHitResult Hit;
ChildActor->K2_SetActorRelativeTransform(RelTransform, false, Hit, true); See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?