Camera::pointAtPedBone: Difference between revisions
MrPancakers (talk | contribs) (Created an example, removed old documentation.) |
m (Replaced HTML with template) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
< | <pre>camera.pointAtPedBone(ped, boneIndex, x, y, z, p6);</pre> | ||
=== Required Arguments === | === Required Arguments === | ||
*'''ped:''' int | *'''ped:''' int | ||
| Line 12: | Line 13: | ||
*'''z:''' float | *'''z:''' float | ||
*'''p6:''' Boolean (The bool p6 is unknown, but through every X360 script it's always 1.) | *'''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. | This event locks the camera onto the players hand. | ||
{{ClientsideCode| | |||
<pre> | |||
< | |||
let handCamera = mp.cameras.new('default', new mp.Vector3(0, 0, 0), new mp.Vector3(0,0,0), 40); | let handCamera = mp.cameras.new('default', new mp.Vector3(0, 0, 0), new mp.Vector3(0,0,0), 40); | ||
| Line 25: | Line 27: | ||
let playerPosition = mp.players.local.position | let playerPosition = mp.players.local.position | ||
handCamera.setActive(true); | |||
handCamera.pointAtPedBone(mp.players.local.handle, 57005, 0, 0, 0, true); | handCamera.pointAtPedBone(mp.players.local.handle, 57005, 0, 0, 0, true); | ||
handCamera.setCoord(playerPosition.x + 1, playerPosition.y + 1, playerPosition.z); | handCamera.setCoord(playerPosition.x + 1, playerPosition.y + 1, playerPosition.z); | ||
mp.game.cam.renderScriptCams(true, false, 0, true, false); | 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]] | ||
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
- 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: