VehicleClient

getVehicleDeformationAtPos

GET_VEHICLE_DEFORMATION_AT_POS0x4EC6CFBC7B2E9536

The GTA V native GET_VEHICLE_DEFORMATION_AT_POS of the VEHICLE namespace, as LS:MP client scripts call it: the global function getVehicleDeformationAtPos, in JavaScript and in Lua.

SignatureJavaScript
getVehicleDeformationAtPos(
  vehicle: Vehicle,
  offsetX: number,
  offsetY: number,
  offsetZ: number
): { x: number, y: number, z: number }
SignatureLua
getVehicleDeformationAtPos(
  vehicle: Vehicle,
  offsetX: number,
  offsetY: number,
  offsetZ: number
): Vector3

Usage

JavaScript
const { x, y, z } = getVehicleDeformationAtPos(vehicle, offsetX, offsetY, offsetZ);
Lua
local coords = getVehicleDeformationAtPos(vehicle, 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 = getVehicleDeformationAtPos(vehicle, offset);
Lua · with vectors
local coords = getVehicleDeformationAtPos(vehicle, offset)

Parameters

ParameterTypeJavaScriptLua
vehicleVehiclenumberinteger
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.

The only example I can find of this function in the scripts, is this:

struct _s = getVehicleDeformationAtPos(rPtr((A_0) + 4), 1.21f, 6.15f, 0.3f);

PC scripts:

v_5/*{3}*/ = getVehicleDeformationAtPos(a_0._f1, 1.21, 6.15, 0.3);

Reference

Namespace
Vehicle VEHICLE
In the game
Vector3 GET_VEHICLE_DEFORMATION_AT_POS(Vehicle vehicle, float offsetX, float offsetY, float offsetZ)
Hash
0x4EC6CFBC7B2E9536

Open in the interactive natives reference