Community Forum

Render camera

Forum Overview >> Scripting

CategoryScripting
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 ?

Greetings

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 ?

Code:

test = {}

function test:loadMap()
self.isCreated = false
end

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

self.isCreated = true
end
end

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)
end

addModEventListener(test)

VertexFloat 08.06.2022 17:34
It's completely uncorrect. If you want, write to me (https://www.facebook.com/VertexFloat or vertexfloat@gmail.com) 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.