RealDocs

AActor::K2_SetActorLocation

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

Description

Moves the actor to the specified world-space location. This is the Blueprint-callable version of SetActorLocation, surfaced as 'Set Actor Location' in Blueprint graphs.

Caveats & Gotchas

  • In C++, prefer SetActorLocation() which uses ETeleportType instead of a bool for the teleport parameter — the enum is clearer at the call site than true/false.
  • When bSweep is true, only the root component participates in collision sweeping; attached child components move without sweeping even if they have blocking collision.

Signature

ENGINE_API bool K2_SetActorLocation(FVector NewLocation, bool bSweep, FHitResult& SweepHitResult, bool bTeleport)

Parameters

Name Type Description Default
NewLocation FVector The target world-space location to move the actor to.
bSweep bool If true, sweeps to the destination and stops on blocking collision. Only the root component is swept.
SweepHitResult FHitResult& Populated with hit information if bSweep is true and a blocking hit occurred.
bTeleport bool If true, physics velocity is preserved (teleport). If false, velocity is recalculated from the position delta.

Return Type

bool

Examples

Move the player character to a new world location on BeginPlay Blueprint
Event BeginPlay Cast To MyCharacter Object Cast Failed As My Character As My Character Set Actor Location Target is Actor Target New Location Sweep false Teleport true Return Value Sweep Hit Result Get Player Character Player Index 0 0 Return Value Make Vector X 0.0 Y 0.0 Z 200.0 Return Value Return Value
Edit Blueprint graph Move the player character to a new world location 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
Teleport actor to a new location C++
FHitResult Hit;
bool bMoved = K2_SetActorLocation(FVector(0.f, 0.f, 200.f), false, Hit, true);

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.