Camera::pointAtPedBone: Difference between revisions

From RAGE Multiplayer Wiki
mNo edit summary
(Created an example, removed old documentation.)
Line 1: Line 1:
Parameters p0-p5 seems correct. The bool p6 is unknown, but through every X360 script it's always 1. Please correct p0-p5 if any prove to be wrong.  
Sets the camera so it's pointing towards a ped's bone.
 
Bones List: [[Bones]]
 
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">camera.pointAtPedBone(ped, boneIndex, x, y, z, p6);</syntaxhighlight>
<syntaxhighlight lang="javascript">camera.pointAtPedBone(ped, boneIndex, x, y, z, p6);</syntaxhighlight>
Line 8: Line 11:
*'''y:''' float
*'''y:''' float
*'''z:''' float
*'''z:''' float
*'''p6:''' Boolean
*'''p6:''' Boolean (The bool p6 is unknown, but through every X360 script it's always 1.)
===Return value===
===Return value===
*'''Undefined'''
*'''Undefined'''
==Example==
==Example==
This event locks the camera onto the players hand.
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #AE4040;">
<div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div>
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
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.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);
});
</syntaxhighlight>
</syntaxhighlight>
</div>
==See also==
==See also==
{{Camera_definition_c}}
{{Camera_definition_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]

Revision as of 05:22, 17 June 2018

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