a library to speed up the development of Fivem scripts and frameworks
fivem-ts - Documentation v0.7.5 • Docs
fivem-ts - Documentation v0.7.5 / Client / Camera
The Camera class provides methods to manipulate and control camera.
new Camera(
handle):Camera
• handle: number
getDepthOfFieldStrength():number
Gets the strength of the depth of field effect for the current camera.
setDepthOfFieldStrength(strength):void
Sets the strength of the depth of field effect for the camera.
• strength: number
The desired strength of the depth of field effect. This should be a numerical value that determines the intensity of the effect.
number
The strength of the depth of field effect.
getDirection():Vector3
Gets the direction vector.
setDirection(direction):void
Sets the direction vector and adjusts the rotation angles accordingly.
• direction: Vector3
The input vector representing the direction.
The forward direction vector.
getFarClip():number
Retrieves the far clipping distance for the camera.
setFarClip(farClip):void
Sets the far clipping distance for the camera.
• farClip: number
The distance at which the camera will stop rendering objects.
number
The far clipping distance.
getFarDepthOfField():number
Retrieves the far depth of field value for the current camera handle.
setFarDepthOfField(farDepthOfField):void
Sets the far depth of field value for the camera.
• farDepthOfField: number
The distance from the camera lens to the farthest object in focus.
number
The far depth of field value.
getFieldOfView():number
Retrieves the field of view of the camera associated with the given handle.
setFieldOfView(fieldOfView):void
Sets the camera’s field of view.
• fieldOfView: number
A number representing the new field of view to be set for the camera.
number
The field of view of the camera.
getForwardVector():Vector3
Calculates and returns the forward vector of an entity based on its current rotation. The forward vector represents the direction in which the entity is facing.
The normalized forward vector computed from the entity’s rotation.
getHandle():number
Retrieves the handle associated with this object.
setHandle(value):void
Sets the handle value.
• value: number
number
getIsActive():boolean
Checks if the camera associated with the current handle is active.
setIsActive(value):void
Sets the active state of the camera.
• value: boolean
The desired active state of the camera. True to activate, false to deactivate.
boolean
true if the camera is active, false otherwise.
getIsInterpolating():boolean
Indicates whether the current object is in an interpolating state.
boolean
True if the object is currently interpolating; otherwise, false.
getIsShaking():boolean
Checks if the camera is currently shaking.
boolean
True if the camera is shaking, false otherwise.
getNearClip():number
Retrieves the near clipping distance of the camera.
setNearClip(nearClip):void
Sets the near clipping plane distance for the camera.
• nearClip: number
The distance to the near clipping plane. Objects closer than this distance to the camera will not be rendered.
number
The near clipping distance of the camera.
getNearDepthOfField():number
Retrieves the near depth of field value for the camera.
setNearDepthOfField(nearDepthOfField):void
Sets the near depth of field value for the camera.
• nearDepthOfField: number
The new near depth of field value to be applied.
number
The near depth of field value.
getPosition():Vector3
Gets the current position of the camera as a Vector3 object.
setPosition(pos):void
Sets the camera’s position in the 3D space.
• pos: Vector3
The position vector containing the x, y, and z coordinates to set the camera’s position.
The position of the camera.
getRotation():Vector3
Retrieves the current rotation of the camera as a Vector3 object.
setRotation(rot):void
Sets the rotation of the camera using a Vector3 object.
• rot: Vector3
A Vector3 object containing the rotation values for x, y, and z axes.
A Vector3 instance containing the rotation values (pitch, roll, yaw) of the camera.
attachTo(
object,offset):void
Attach the camera to an Entity or a PedBone with a specified offset.
The object to which the camera will be attached. This can either be an Entity or a PedBone.
• offset: Vector3
The offset from the object where the camera will be positioned.
void
delete():
void
Deletes the camera associated with the current instance by calling the DestroyCam function and passing the handle of the camera.
void
detach():
void
Detaches the camera associated with the current instance.
void
exists():
boolean
Checks if a camera exists based on its handle.
boolean
True if the camera exists, otherwise false.
interpTo(
camTo,duration,easePosition,easeRotation):void
Interpolates the current camera to another camera over a specified duration with options for easing position and rotation.
• camTo: Camera
The target camera to interpolate to.
• duration: number
The time in milliseconds over which the interpolation will occur.
• easePosition: boolean
Determines whether the interpolation should ease the position.
• easeRotation: boolean
Determines whether the interpolation should ease the rotation.
void
pointAt(
target,offset?):void
Points the camera at a specified target with an optional offset.
• target: Vector3 | Entity | PedBone
The target to point the camera at. This can be an entity, a ped bone, or a specific coordinate.
• offset?: Vector3 = ...
The optional offset to apply when pointing the camera. Defaults to (0, 0, 0).
void
setMotionBlurStrength(
strength):void
Sets the motion blur strength for the camera.
• strength: number
A value representing the new strength of the motion blur effect.
void
setShakeAmplitude(
amplitude):void
Sets the shake amplitude for the camera.
• amplitude: number
The amplitude to set for the camera shake.
void
shake(
type,amplitude):void
Applies a shaking effect to the camera.
• type: CameraShake
The type of camera shake to apply.
• amplitude: number
The intensity of the shake effect.
void
stopPointing():
void
Stops the camera from pointing at its current target.
void
stopShaking():
void
Stops the camera from shaking.
This method stops any ongoing camera shake effect associated with the current handle.
void