CameraClient

attachCamToEntity

ATTACH_CAM_TO_ENTITY0xFEDB7D269E8C60E3

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

SignatureJavaScript
attachCamToEntity(
  cam: Cam,
  entity: Entity,
  xOffset: number,
  yOffset: number,
  zOffset: number,
  isRelative: boolean
): void
SignatureLua
attachCamToEntity(
  cam: Cam,
  entity: Entity,
  xOffset: number,
  yOffset: number,
  zOffset: number,
  isRelative: boolean
)

Usage

JavaScript
attachCamToEntity(cam, entity, xOffset, yOffset, zOffset, isRelative);
Lua
attachCamToEntity(cam, entity, xOffset, yOffset, zOffset, isRelative)

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
attachCamToEntity(cam, entity, offset, isRelative);
Lua · with vectors
attachCamToEntity(cam, entity, offset, isRelative)

Parameters

ParameterTypeJavaScriptLua
camCamnumberinteger
entityEntitynumberinteger
xOffsetfloatnumbernumber
yOffsetfloatnumbernumber
zOffsetfloatnumbernumber
isRelativeBOOLbooleanboolean

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.

Last param determines if its relative to the Entity

Reference

Namespace
Camera CAM
In the game
void ATTACH_CAM_TO_ENTITY(Cam cam, Entity entity, float xOffset, float yOffset, float zOffset, BOOL isRelative)
Hash
0xFEDB7D269E8C60E3

Open in the interactive natives reference