EntityClient

getOffsetFromEntityInWorldCoords

GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS0x1899F328B0E12848

The GTA V native GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS of the ENTITY namespace, as LS:MP client scripts call it: the global function getOffsetFromEntityInWorldCoords, in JavaScript and in Lua.

SignatureJavaScript
getOffsetFromEntityInWorldCoords(
  entity: Entity,
  offsetX: number,
  offsetY: number,
  offsetZ: number
): { x: number, y: number, z: number }
SignatureLua
getOffsetFromEntityInWorldCoords(
  entity: Entity,
  offsetX: number,
  offsetY: number,
  offsetZ: number
): Vector3

Usage

JavaScript
const { x, y, z } = getOffsetFromEntityInWorldCoords(entity, offsetX, offsetY, offsetZ);
Lua
local coords = getOffsetFromEntityInWorldCoords(entity, offsetX, offsetY, offsetZ)
-- coords.x, coords.y, coords.z

Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.

JavaScript · with vectors
const coords = getOffsetFromEntityInWorldCoords(entity, offset);
Lua · with vectors
local coords = getOffsetFromEntityInWorldCoords(entity, offset)

Parameters

ParameterTypeJavaScriptLua
entityEntitynumberinteger
offsetXfloatnumbernumber
offsetYfloatnumbernumber
offsetZfloatnumbernumber

Returns

Vector3 JavaScript { x: number, y: number, z: number }, Lua Vector3

A 3D vector. JavaScript gets a plain { x, y, z } object; Lua gets a real Vector3, with .x .y .z and arithmetic. As an argument, one vector fills three consecutive coordinates.

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Offset values are relative to the entity.

x = left/right
y = forward/backward
z = up/down

Reference

Namespace
Entity ENTITY
In the game
Vector3 GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(Entity entity, float offsetX, float offsetY, float offsetZ)
Hash
0x1899F328B0E12848

Open in the interactive natives reference