- Documentation
- Client functions
- createCameraRender
Function
createCameraRender
Creates a second camera that renders the world into a texture: a car mirror, CCTV, a screen showing a drone view. Draw the texture with dxDrawImage, dxDrawMaterialLine3D or pass it to a shader. Size 16-2048 pixels, 0-60 shots per second (0 = only on request with renderCameraMatrix/updateCameraRender). Every shot is an extra scene render, so it costs performance.
Syntax
element createCameraRender(int width, int height [, float fps = 30])Arguments
widthint- Width 16-2048.
heightint- Height 16-2048.
fpsfloat, optional = 30- Shots per second 0-60.
Returns
The camera (texture) or false.
Example
A CCTV camera on Grove Street shown in the corner of the screen.
local cam = createCameraRender(480, 270, 15)
setCameraRenderMatrix(cam, 2510, -1660, 25, 2495, -1687, 13)
addEventHandler("onClientRender", root, function()
dxDrawImage(20, 20, 320, 180, cam)
end)
Notes
A second camera. The world seen from any place goes into a texture you can draw on the screen or on an object.
See also
attachCameraRenderAttaches the camera to an element (a vehicle, a player, a ped, an object, a model object). The position and target are in metres in the element's frame (x right, y forward, z up); the target defaults to 10 m in front of the camera. A rear-view mirror is a camera at the back of the car looking backwards plussetCameraRenderMirrored.setCameraRenderMatrixPlaces the camera likesetCameraMatrix: the position, the point it looks at, roll and field of view (5-170, 70 by default). It detaches the camera from an element.startCameraRecordingRecords the image of a camera fromcreateCameraRenderinto memory (no sound). Returns a recording element. 1-60 frames per second, up to 600 seconds, JPEG quality 1-100. The camera should take at least as many shots per second as the recording, otherwise frames repeat.setCameraRenderMirroredMirrors the camera image horizontally (a mirror). Also applies to recordings from this camera.isCameraRenderChecks whether a value is a working camera fromcreateCameraRender.