RealDocs

UGameplayStatics::RebaseZeroOriginOntoLocal

function Engine Blueprint Since 4.5
#include "Kismet/GameplayStatics.h"
Access: public Specifiers: staticBlueprintPure

Description

Converts an absolute origin-based position (e.g. received over the network or deserialized) into a local world-space position relative to the current shifted origin. The inverse of RebaseLocalOriginOntoZero.

Caveats & Gotchas

  • The naming is counterintuitive: the input 'WorldLocation' is an absolute zero-origin position, not a current local-space position.
  • Must be applied after every world origin shift to remain accurate — a value rebased before a shift and used after it will have floating-point drift equal to the shift magnitude.
  • Network-received positions should be rebased immediately on receipt before being passed to SetActorLocation or used in physics calculations.

Signature

static ENGINE_API FVector RebaseZeroOriginOntoLocal(UObject* WorldContextObject, FVector WorldLocation);

Parameters

Name Type Description Default
WorldContextObject UObject* Any UObject within the world to provide world context.
WorldLocation FVector An absolute position expressed relative to the integer world origin (zero-based).

Return Type

FVector

Example

Apply a network-received position in a shifted world C++
// ReceivedPos is in absolute zero-origin space (sent by server)
FVector LocalPos = UGameplayStatics::RebaseZeroOriginOntoLocal(this, ReceivedPos);
RemoteActor->SetActorLocation(LocalPos);

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.