RealDocs

AActor::ApplyWorldOffset

function Engine Since 4.5
#include "GameFramework/Actor.h"
Access: public Specifiers: virtual

Description

Shifts the actor's location and all relevant internal data structures by the given offset vector. Called by the engine during level streaming and world origin rebasing; rarely called directly.

Caveats & Gotchas

  • Never call this directly unless you are implementing a custom streaming or origin-rebasing system — normal actor movement should use SetActorLocation or AddActorWorldOffset.
  • Overrides must call Super::ApplyWorldOffset() first to ensure base class components (including physics state and navigation) are shifted before derived-class data.
  • bWorldShift=true indicates a global origin rebase; in this case floating-point precision improvements are the goal, and all persistent world positions must be updated consistently.

Signature

ENGINE_API virtual void ApplyWorldOffset(const FVector& InOffset, bool bWorldShift);

Parameters

Name Type Description Default
InOffset const FVector& The world-space delta to apply to the actor's position and all relevant data structures.
bWorldShift bool True when the offset is part of a global world origin shift; false for local level-streaming shifts.

Return Type

void

Example

Override to shift a custom position cache C++
void AMyActor::ApplyWorldOffset(const FVector& InOffset, bool bWorldShift)
{
	Super::ApplyWorldOffset(InOffset, bWorldShift);
	// Shift any cached world positions stored outside of components
	CachedWorldPosition += InOffset;
}

Version History

Introduced in: 4.5

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.