ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. createCameraRender

Function

createCameraRender

ClientDrawing (dx)Trilogy Hub only

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