Camera::pointAtPedBone: Difference between revisions

From RAGE Multiplayer Wiki
mNo edit summary
m (Replaced HTML with template)
 
(2 intermediate revisions by one other user not shown)
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>
<pre>camera.pointAtPedBone(ped, boneIndex, x, y, z, p6);</pre>
 
=== Required Arguments ===
=== Required Arguments ===
*'''ped:''' int
*'''ped:''' int
Line 8: Line 12:
*'''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==
<syntaxhighlight lang="javascript">
This event locks the camera onto the players hand.
// todo
 
</syntaxhighlight>
{{ClientsideCode|
<pre>
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);
});
</pre>
}}
 
==See also==
==See also==
{{Camera_definition_c}}
{{Camera_definition_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]

Latest revision as of 13:18, 26 October 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.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