RealDocs

AActor::SetActorRelativeTransform

function Engine Since 4.6
#include "GameFramework/Actor.h"
Access: public

Description

Sets the full transform (location, rotation, and scale) of this actor's root component relative to its parent in the attachment hierarchy. Prefer this over separate relative location + rotation calls when changing both at once.

Caveats & Gotchas

  • Unlike SetActorTransform (world space), this sets the relative transform. If the actor is unattached, relative transform equals world transform, making the two calls equivalent — but using the correct variant communicates intent.
  • Scale is included in this call, unlike AddActorWorldTransform which ignores scale. Accidentally passing a delta scale of zero will flatten the actor.
  • When teleporting simulated physics without ETeleportType::TeleportPhysics, attached child physics bodies may lag behind by one frame until physics re-integrates.

Signature

ENGINE_API void SetActorRelativeTransform(const FTransform& NewRelativeTransform, bool bSweep=false, FHitResult* OutSweepHitResult=nullptr, ETeleportType Teleport = ETeleportType::None)

Parameters

Name Type Description Default
NewRelativeTransform const FTransform& The new transform (location, rotation, scale) of the actor's root component relative to its parent.
bSweep bool If true, sweeps to the destination transform, stopping at blocking geometry. false
OutSweepHitResult FHitResult* If provided and bSweep is true, receives the blocking hit. nullptr
Teleport ETeleportType Controls physics state: TeleportPhysics preserves velocity; None recalculates it. ETeleportType::None

Return Type

void

Example

Snap an attached actor to a specific relative pose C++
FTransform RelativePose(
	FRotator(0.f, 90.f, 0.f),
	FVector(50.f, 0.f, 0.f),
	FVector::OneVector
);
SetActorRelativeTransform(RelativePose);

Version History

Introduced in: 4.6

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.