AActor::K2_SetActorLocationAndRotation
#include "GameFramework/Actor.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Moves and rotates the actor to the specified world-space location and rotation in a single call. More efficient than calling SetActorLocation and SetActorRotation separately because the transform update is performed once.
Caveats & Gotchas
- • The single-call version is more efficient than two separate calls because the render state is only dirtied once and child component transforms are propagated in a single pass.
- • When bSweep is true, only the translation is swept for collision — the rotation component is applied without sweep regardless. An actor can still rotate through geometry with bSweep enabled.
Signature
ENGINE_API bool K2_SetActorLocationAndRotation(FVector NewLocation, FRotator NewRotation, bool bSweep, FHitResult& SweepHitResult, bool bTeleport) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewLocation | FVector | The target world-space location. | — |
| NewRotation | FRotator | The target world-space rotation. | — |
| bSweep | bool | If true, sweeps the root component to the destination and stops on blocking collision. | — |
| SweepHitResult | FHitResult& | Populated with hit data if bSweep is true and a blocking hit occurred. | — |
| bTeleport | bool | If true, physics velocity is preserved. If false, it is updated from the position/rotation delta. | — |
Return Type
bool Examples
Teleport the player to a new location and rotation on BeginPlay
Blueprint
Teleport actor to a spawn point transform C++
FHitResult Hit;
K2_SetActorLocationAndRotation(
SpawnPoint->GetActorLocation(),
SpawnPoint->GetActorRotation(),
false, Hit, true); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?