RealDocs

AActor::K2_SetActorRelativeLocation

function Engine Blueprint Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: UFUNCTIONBlueprintCallable

Description

Sets the actor's RootComponent to the given location relative to its parent actor. If the actor has no parent, the relative location equals the world location.

Caveats & Gotchas

  • When the actor is not attached to a parent, this sets the world location — the 'relative' framing only applies when the actor is a child in an attachment hierarchy.
  • In C++ prefer SetActorRelativeLocation, which uses ETeleportType and an optional FHitResult pointer instead of the bool/ref Blueprint binding.

Signature

ENGINE_API void K2_SetActorRelativeLocation(FVector NewRelativeLocation, bool bSweep, FHitResult& SweepHitResult, bool bTeleport);

Parameters

Name Type Description Default
NewRelativeLocation FVector The new location relative to the actor's parent (or world origin if unattached).
bSweep bool Whether to sweep to the destination, stopping if blocked.
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 the displacement.

Return Type

void

Examples

Offset this actor relative to its parent on BeginPlay Blueprint
Event BeginPlay Set Actor Relative Location Target is Actor Target New Relative Location New Relative Location Sweep false Teleport false Sweep Hit Result Make Vector X 0.0 Y 100.0 Z 50.0 Return Value Return Value
Edit Blueprint graph Offset this actor relative to its parent on BeginPlay
Drag node headers to move · Drag from an output pin to an input pin to connect · Scroll to zoom · Right-click for actions
Reposition an attached child actor relative to its parent C++
// ChildActor is attached to ParentActor
FHitResult Hit;
ChildActor->K2_SetActorRelativeLocation(FVector(0.f, 100.f, 50.f), false, Hit, false);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.