Camera::pointAtPedBone: Difference between revisions
MrPancakers (talk | contribs) mNo edit summary |
MrPancakers (talk | contribs) (Created an example, removed old documentation.) |
||
| Line 1: | Line 1: | ||
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"> | ||
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]] | ||
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
- Functions:
- Camera::Camera
- Camera.animatedShake
- Camera.attachTo
- Camera.attachToPedBone
- Camera.destroy
- Camera.detach
- Camera.doesExist
- Camera.getAnimCurrentPhase
- Camera.getCoord
- Camera.getDirection
- Camera.getFarClip
- Camera.getFarDof
- Camera.getFov
- Camera.getNearClip
- Camera.getRot
- Camera.getSplinePhase
- Camera.isActive
- Camera.isInterpolating
- Camera.isPlayingAnim
- Camera.isRendering
- Camera.isShaking
- Camera.playAnim
- Camera.pointAt
- Camera.pointAtCoord
- Camera.pointAtPedBone
- Camera.setActive
- Camera.setActiveWithInterp
- Camera.setAffectsAiming
- Camera.setAnimCurrentPhase
- Camera.setCoord
- Camera.setDebugName
- Camera.setDofFnumberOfLens
- Camera.setDofFocusDistanceBias
- Camera.setDofMaxNearInFocusDistance
- Camera.setDofMaxNearInFocusDistanceBlendLevel
- Camera.setDofPlanes
- Camera.setDofStrength
- Camera.setFarClip
- Camera.setFarDof
- Camera.setFov
- Camera.setInheritRollVehicle
- Camera.setMotionBlurStrength
- Camera.setNearClip
- Camera.setNearDof
- Camera.setParams
- Camera.setRot
- Camera.setShakeAmplitude
- Camera.setUseShallowDofMode
- Camera.shake
- Camera.stopPointing
- Camera.stopShaking
- Camera.setDofParam
- Camera.getDofParam
- Properties: