Community Forum

Render camera

Forum Overview >> Scripting

Created07.06.2021 19:54

Tomas Roy (TomRoyo) 07.06.2021 19:54
Hello guys, can I somehow render camera view at a specific location on the screen. If yes, what should I use ?


Bilbo Beutlin (BBeutlin) 09.06.2021 19:33
Lookup in scripts/gui/elements/RenderElement.lua

Basically you need to create an overlay and draw it on display by 'renderOverlay(overlay, posX, posY, sizeX, sizeY)' continously by the draw() or onDraw() function of your script.

I didn't try yet myself, so I can't give a detailed description.

Tomas Roy (TomRoyo) 09.06.2021 20:48
Thanks for answear Bilbo, I will try it ;)

Mike Freight (Mikey) 07.06.2022 23:30
Hi, I tried to do that and it doesn't work at all. Does anyone can help me with it ?


test = {}

function test:loadMap()
self.isCreated = false

function test:update()
if self.isCreated == false then
self.overlay = createRenderOverlay(g_currentMission.player.cameraNode, getScreenAspectRatio(), 512, 512, true, 255, 16711680)

self.isCreated = true

function test:draw()
print(self.overlay) --> 105950.000000

local uiScale = g_gameSettings:getValue("uiScale")
local startX = 0.25
local startY = 0
local width = 0.50 * uiScale
local height = width * g_screenAspectRatio

renderOverlay(self.overlay, startX, startY, width, height)


VertexFloat 08.06.2022 17:34
It's completely uncorrect. If you want, write to me ( or and I will not say how, because you have to find it yourself, but I will outline what and how.

Note: Log in to post. Create a new account here.