RealDocs

APawn::OutsideWorldBounds

function Engine Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: virtualoverride

Description

Called when the pawn moves outside the world's kill-Z or bounding box. The default implementation kills the pawn by calling TakeDamage with a high damage value and a FOutOfBoundsEvent.

Caveats & Gotchas

  • The engine guards against re-entry with bProcessingOutsideWorldBounds — but if your override spawns or moves actors that themselves fall out of bounds during the same event, nested calls may be silently dropped.
  • The default kill path calls TakeDamage, which means ShouldTakeDamage() is evaluated. If your pawn is set to be invulnerable (e.g., in a respawn sequence), it can survive the out-of-bounds kill — add an explicit teleport-to-spawn fallback.
  • For player pawns, the PlayerController's RPC to the client is sent before Destroyed() is called, so the client may briefly display a dead pawn before the destroy arrives.

Signature

virtual void OutsideWorldBounds() override

Return Type

void

Example

Teleport pawn back to start instead of killing it C++
void AMyPawn::OutsideWorldBounds()
{
	// Respawn at origin instead of the default kill behavior
	SetActorLocation(FVector::ZeroVector);
	SetActorVelocity(FVector::ZeroVector);
	// Do NOT call Super — we are replacing the kill behavior
}

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.