How can i draw a bounding box around all objects that are currently streamed in?
I tried with this code but it doesnt draw anything and i dont know why
function render()
for i,v in ipairs(getElementsByType("object", root, true))do
local x,y,z = getElementPosition(v)
local mix,miy,miz,max,may,maz = getElementBoundingBox(v)
local x1,y1 = getScreenFromWorldPosition(mix+x,miy+y,miz+z)
local x2,y2 = getScreenFromWorldPosition(max+x,may+y,maz+z)
dxDrawLine(x1,y1,x2,y2,tocolor(255,0,0,255))
end
end
addEventHandler("onClientRender", root, render)