GetCamRot
Docslocal retval = GetCamRot(cam, rotationOrder)Description
Gets a camera's rotation by handle (cam) lookup, outputs a Vector3 in degrees.
Parameters
| Name | Type | Description |
|---|---|---|
cam | Cam | The camera handle. |
rotationOrder | int | The order of rotation, see [`GET_ENTITY_ROTATION`](#\_0xAFBD61CC738D9EB9) |
Quick Snippet: Scripted Cameracam
camUse this to create and control a scripted camera for this native.
-- Create a scripted camera at the player's position
local coords = GetEntityCoords(PlayerPedId())
local cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)
SetCamCoord(cam, coords.x, coords.y, coords.z + 2.0)
SetCamRot(cam, -15.0, 0.0, GetEntityHeading(PlayerPedId()))
SetCamFov(cam, 70.0)
SetCamActive(cam, true)
RenderScriptCams(true, true, 500, true, true)
-- Restore gameplay camera:
-- RenderScriptCams(false, true, 500, true, true)
-- DestroyCam(cam, true)Returns
Vector3Returns a 3D vector (x, y, z).
Examples
Official
-- We need a valid camera handle for this to work.
local theCamHandle = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)
-- Let's set the camera rotation for illustrative purposes
SetCamRot(theCamHandle, 0.1, 0.2, 0.3, 0)
-- We are now able to get the camera rotation.
local camRot = GetCamRot(theCamHandle, 0) -- vector3(0.100000, 0.200000, 0.300000)
Citizen.Trace(string.format("Cam Rotation is x: %f, y: %f, z: %f", camRot.x, camRot.y, camRot.z))