AActor::K2_TeleportTo
#include "GameFramework/Actor.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Moves this actor to the specified location and rotation, attempting to avoid overlapping geometry by nudging slightly out of walls. Returns false if the actor could not fit at the destination.
Caveats & Gotchas
- • Unlike SetActorLocation, TeleportTo sweeps for valid placement and tries to push the actor out of blocking geometry — it may place the actor at a slightly different position than requested if the exact spot is blocked.
- • For characters with a movement component, prefer calling ACharacter::TeleportTo or using the movement component's safe teleport path; raw K2_TeleportTo bypasses movement component state which can cause physics/velocity artifacts.
- • The return value is frequently ignored in practice but is critical in gameplay-critical code — if false, the actor may still be at its old location.
Signature
ENGINE_API bool K2_TeleportTo( FVector DestLocation, FRotator DestRotation ); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| DestLocation | FVector | The target world location to teleport to. | — |
| DestRotation | FRotator | The target world rotation at the destination. | — |
Return Type
bool Examples
Teleport self to a fixed world location and rotation on BeginPlay
Blueprint
Teleport an actor to a spawn point C++
AActor* SpawnPoint = GetSpawnPoint();
if (SpawnPoint)
{
bool bSuccess = MyActor->K2_TeleportTo(
SpawnPoint->GetActorLocation(),
SpawnPoint->GetActorRotation()
);
if (!bSuccess)
{
UE_LOG(LogGame, Warning, TEXT("Teleport failed — destination blocked"));
}
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?