AActor::K2_SetActorRelativeLocation
#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
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); See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?