getEntitySpeedVector
GET_ENTITY_SPEED_VECTOR0x9A8D700A51CB7B0DThe GTA V native GET_ENTITY_SPEED_VECTOR of the ENTITY namespace, as LS:MP client scripts call it: the global function getEntitySpeedVector, in JavaScript and in Lua.
getEntitySpeedVector(
entity: Entity,
relative: boolean
): { x: number, y: number, z: number }getEntitySpeedVector(entity: Entity, relative: boolean): Vector3Usage
JavaScript
const { x, y, z } = getEntitySpeedVector(entity, relative);Lua
local coords = getEntitySpeedVector(entity, relative)
-- coords.x, coords.y, coords.zParameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
entity | Entity | number | integer |
relative | BOOL | boolean | boolean |
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.
Relative can be used for getting speed relative to the frame of the vehicle, to determine for example, if you are going in reverse (-y speed) or not (+y speed).
Reference
- Namespace
- Entity ENTITY
- In the game
Vector3 GET_ENTITY_SPEED_VECTOR(Entity entity, BOOL relative)- Hash
0x9A8D700A51CB7B0D