Camera::pointAtPedBone

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

Sets the camera so it's pointing towards a ped's bone.

Bones List: Bones

Syntax

camera.pointAtPedBone(ped, boneIndex, x, y, z, p6);

Required Arguments

  • ped: int
  • boneIndex: int
  • x: float
  • y: float
  • z: float
  • p6: Boolean (The bool p6 is unknown, but through every X360 script it's always 1.)

Return value

  • Undefined

Example

This event locks the camera onto the players hand.

Client-Side
let handCamera = mp.cameras.new('default', new mp.Vector3(0,  0,  0), new mp.Vector3(0,0,0), 40);

mp.events.add("handCam", () => {
    let playerPosition = mp.players.local.position
    
    handCamera.setActive(true);
    handCamera.pointAtPedBone(mp.players.local.handle, 57005, 0, 0, 0, true);
    handCamera.setCoord(playerPosition.x + 1, playerPosition.y + 1, playerPosition.z);
    mp.game.cam.renderScriptCams(true, false, 0, true, false);
});

See also