RealDocs

AActor::K2_SetActorLocationAndRotation

function Engine Blueprint Since 4.0
#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
Event BeginPlay Cast To MyCharacter Object Cast Failed As My Character As My Character Set Actor Location And Rotation Target is Actor Target New Location New Rotation Sweep false Teleport true Return Value Sweep Hit Result Get Player Character Player Index 0 0 Return Value Make Vector X 500.0 Y 200.0 Z 100.0 Return Value Return Value Make Rotator Pitch 0.0 Yaw 90.0 Roll 0.0 Return Value Return Value
Edit Blueprint graph Teleport the player to a new location and rotation 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 spawn point transform C++
FHitResult Hit;
K2_SetActorLocationAndRotation(
    SpawnPoint->GetActorLocation(),
    SpawnPoint->GetActorRotation(),
    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.