CameraClient

attachCamToVehicleBone

ATTACH_CAM_TO_VEHICLE_BONE0x8DB3F12A02CAEF72

The GTA V native ATTACH_CAM_TO_VEHICLE_BONE of the CAM namespace, as LS:MP client scripts call it: the global function attachCamToVehicleBone, in JavaScript and in Lua.

SignatureJavaScript
attachCamToVehicleBone(
  cam: Cam,
  vehicle: Vehicle,
  boneIndex: number,
  relativeRotation: boolean,
  rotX: number,
  rotY: number,
  rotZ: number,
  offsetX: number,
  offsetY: number,
  offsetZ: number,
  fixedDirection: boolean
): void
SignatureLua
attachCamToVehicleBone(
  cam: Cam,
  vehicle: Vehicle,
  boneIndex: integer,
  relativeRotation: boolean,
  rotX: number,
  rotY: number,
  rotZ: number,
  offsetX: number,
  offsetY: number,
  offsetZ: number,
  fixedDirection: boolean
)

Usage

JavaScript
attachCamToVehicleBone(
  cam, vehicle, boneIndex, relativeRotation, rotX, rotY, rotZ, offsetX, offsetY, offsetZ,
  fixedDirection
);
Lua
attachCamToVehicleBone(
    cam, vehicle, boneIndex, relativeRotation, rotX, rotY, rotZ, offsetX, offsetY, offsetZ,
    fixedDirection
)

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
attachCamToVehicleBone(cam, vehicle, boneIndex, relativeRotation, rot, offset, fixedDirection);
Lua · with vectors
attachCamToVehicleBone(cam, vehicle, boneIndex, relativeRotation, rot, offset, fixedDirection)

Parameters

ParameterTypeJavaScriptLua
camCamnumberinteger
vehicleVehiclenumberinteger
boneIndexintnumberinteger
relativeRotationBOOLbooleanboolean
rotXfloatnumbernumber
rotYfloatnumbernumber
rotZfloatnumbernumber
offsetXfloatnumbernumber
offsetYfloatnumbernumber
offsetZfloatnumbernumber
fixedDirectionBOOLbooleanboolean

Returns

Nothing. In JavaScript the call evaluates to undefined.

Notes

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

This native works with vehicles only. Bone indexes are usually given by this native getEntityBoneIndexByName.

Reference

Namespace
Camera CAM
In the game
void ATTACH_CAM_TO_VEHICLE_BONE(Cam cam, Vehicle vehicle, int boneIndex, BOOL relativeRotation, float rotX, float rotY, float rotZ, float offsetX, float offsetY, float offsetZ, BOOL fixedDirection)
Hash
0x8DB3F12A02CAEF72
Introduced
Game build 1290 legacy numbering
Formerly
_ATTACH_CAM_TO_VEHICLE_BONE

Open in the interactive natives reference