CreateCam
Docslocal retval = CreateCam(camName, active)Description
Creates a camera with the specified cam name, You can use `SET_CAM_` natives to manipulate the camera.\
Make sure to call [RENDER_SCRIPT_CAMS](#\_0x07E5B515DB0636FC) once the camera is created, or this won't have any visible effect.
### Camera names:
* DEFAULT_SCRIPTED_CAMERA
* DEFAULT_ANIMATED_CAMERA
* DEFAULT_SPLINE_CAMERA
* DEFAULT_SCRIPTED_FLY_CAMERA
* TIMED_SPLINE_CAMERA
* CUSTOM_TIMED_SPLINE_CAMERA
* ROUNDED_SPLINE_CAMERA
* SMOOTHED_SPLINE_CAMERA
Parameters
| Name | Type | Description |
|---|---|---|
camName | char* | A string representing the camera type, the game will convert the string into a joaat hash upon native execution. |
active | BOOL | Set to true if you wish to make this new camera the active camera. |
Quick Snippet: Scripted Camera→ Cam
→ 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
CamExamples
Official
local cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)