Camera::attachTo: Difference between revisions
MrPancakers (talk | contribs) (Added example, added description) |
No edit summary |
||
| (One intermediate revision by one other user not shown) | |||
| Line 2: | Line 2: | ||
*JulioNIB:<br>Last param determines if its relative to the Entity | *JulioNIB:<br>Last param determines if its relative to the Entity | ||
==Syntax== | ==Syntax== | ||
< | <pre>camera.attachTo(entity, xOffset, yOffset, zOffset, isRelative);</pre> | ||
=== Required Arguments === | === Required Arguments === | ||
*'''entity:''' Entity handle or object | *'''entity:''' Entity handle or object | ||
| Line 10: | Line 12: | ||
*'''zOffset:''' float | *'''zOffset:''' float | ||
*'''isRelative:''' Boolean | *'''isRelative:''' Boolean | ||
===Return value=== | ===Return value=== | ||
*'''Undefined''' | *'''Undefined''' | ||
==Example== | ==Example== | ||
Attaches a camera to a vehicle and sets it as your active camera. | Attaches a camera to a vehicle and sets it as your active camera. | ||
{{ClientsideCode| | |||
<pre> | |||
< | |||
let mainCar = mp.vehicles.new(mp.game.joaat("turismor"), new mp.Vector3(-421.88, 1136.86, 326)); | let mainCar = mp.vehicles.new(mp.game.joaat("turismor"), new mp.Vector3(-421.88, 1136.86, 326)); | ||
| Line 25: | Line 28: | ||
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]] | ||
[[Category:Camera API]] | |||
Latest revision as of 21:19, 27 March 2019
Attaches your camera to an object.
- JulioNIB:
Last param determines if its relative to the Entity
Syntax
camera.attachTo(entity, xOffset, yOffset, zOffset, isRelative);
Required Arguments
- entity: Entity handle or object
- xOffset: float
- yOffset: float
- zOffset: float
- isRelative: Boolean
Return value
- Undefined
Example
Attaches a camera to a vehicle and sets it as your active camera.
Client-Side
let mainCar = mp.vehicles.new(mp.game.joaat("turismor"), new mp.Vector3(-421.88, 1136.86, 326));
mp.events.add("vehCam", () => {
vehicleCamera.attachTo(mainCar.handle, 0, 0, 2.0, false);
vehicleCamera.setActive(true);
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: