PedClient

getPedBoneCoords

GET_PED_BONE_COORDS0x17C07FC640E86B4E

The GTA V native GET_PED_BONE_COORDS of the PED namespace, as LS:MP client scripts call it: the global function getPedBoneCoords, in JavaScript and in Lua.

SignatureJavaScript
getPedBoneCoords(
  ped: Ped,
  boneId: number,
  offsetX: number,
  offsetY: number,
  offsetZ: number
): { x: number, y: number, z: number }
SignatureLua
getPedBoneCoords(
  ped: Ped,
  boneId: integer,
  offsetX: number,
  offsetY: number,
  offsetZ: number
): Vector3

Usage

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

Parameters

ParameterTypeJavaScriptLuaDescription
pedPednumberintegerThe ped to get the position of a bone from.
boneIdintnumberintegerThe ID of the bone to get the position from. This is NOT the index.
offsetXfloatnumbernumberThe X-component of the offset to add to the position relative to the bone's rotation.
offsetYfloatnumbernumberThe Y-component of the offset to add to the position relative to the bone's rotation.
offsetZfloatnumbernumberThe Z-component of the offset to add to the position relative to the bone's rotation.

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.

Gets the position of the specified bone of the specified ped.

Reference

Namespace
Ped PED
In the game
Vector3 GET_PED_BONE_COORDS(Ped ped, int boneId, float offsetX, float offsetY, float offsetZ)
Hash
0x17C07FC640E86B4E

Open in the interactive natives reference