getOffsetFromEntityGivenWorldCoords
GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS0x2274BC1C4885E333The GTA V native GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS of the ENTITY namespace, as LS:MP client scripts call it: the global function getOffsetFromEntityGivenWorldCoords, in JavaScript and in Lua.
getOffsetFromEntityGivenWorldCoords(
entity: Entity,
posX: number,
posY: number,
posZ: number
): { x: number, y: number, z: number }getOffsetFromEntityGivenWorldCoords(
entity: Entity,
posX: number,
posY: number,
posZ: number
): Vector3Usage
const { x, y, z } = getOffsetFromEntityGivenWorldCoords(entity, posX, posY, posZ);local coords = getOffsetFromEntityGivenWorldCoords(entity, posX, posY, posZ)
-- coords.x, coords.y, coords.zThree consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.
const coords = getOffsetFromEntityGivenWorldCoords(entity, pos);local coords = getOffsetFromEntityGivenWorldCoords(entity, pos)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
entity | Entity | number | integer |
posX | float | number | number |
posY | float | number | number |
posZ | float | number | number |
Returns
Vector3 JavaScript { x: number, y: number, z: number }, Lua Vector3A 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.
Converts world coords (posX - Z) to coords relative to the entity
Example:
posX is given as 50
entity's x coord is 40
the returned x coord will then be 10 or -10, not sure haven't used this in a while (think it is 10 though).
Reference
- Namespace
- Entity ENTITY
- In the game
Vector3 GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS(Entity entity, float posX, float posY, float posZ)- Hash
0x2274BC1C4885E333