Camera::attachToPedBone: Difference between revisions
(yay) |
m (Replaced HTML with template) |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__ | |||
Attaches a camera to the bone specified. | |||
==Syntax== | == Syntax == | ||
< | <pre> | ||
=== | camera.attachToPedBone(ped, boneIndex, x, y, z, heading); | ||
</pre> | |||
=== Parameters === | |||
*'''ped:''' Ped handle or object | *'''ped:''' Ped handle or object | ||
*'''boneIndex:''' | *'''boneIndex:''' {{RageType|Int}} ([[Bones|Bone IDs]]) | ||
*'''x:''' | *'''x:''' {{RageType|Float}} | ||
*'''y:''' | *'''y:''' {{RageType|Float}} | ||
*'''z:''' | *'''z:''' {{RageType|Float}} | ||
*'''heading:''' Boolean | *'''heading:''' {{RageType|Boolean}} | ||
== | |||
== Example == | |||
This creates a camera and then sets it active and attaches it to the player's hand so it stays focused. The camera will not move with the character. | |||
{{ClientsideCode| | |||
</ | <pre> | ||
==See also== | 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.attachToPedBone(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 == | |||
{{Camera_definition_c}} | |||
[[Category:Clientside API]] | [[Category:Clientside API]] | ||
[[Category: | [[Category:Camera API]] | ||
Latest revision as of 13:17, 26 October 2018
Attaches a camera to the bone specified.
Syntax
camera.attachToPedBone(ped, boneIndex, x, y, z, heading);
Parameters
- ped: Ped handle or object
- boneIndex: Int (Bone IDs)
- x: Float
- y: Float
- z: Float
- heading: Boolean
Example
This creates a camera and then sets it active and attaches it to the player's hand so it stays focused. The camera will not move with the character.
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.attachToPedBone(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: