AActor::K2_SetActorLocation
#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
Teleport actor to a new location C++
FHitResult Hit;
bool bMoved = K2_SetActorLocation(FVector(0.f, 0.f, 200.f), false, Hit, true); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?