Anyone know if there's a way to override the renderdistance for RenderView?
3 replies, posted
I've got a RenderView that's in a DFrame acting as a camera of sorts that will allow players to see into another part of the map when they're not actually there. The issue is, whenever they get far enough away, objects start to disappear.
Is there any way around this or am I just SOL?
Code for reference:
if CLIENT then
local tpdframe = vgui.Create( "DFrame" )
tpdframe:SetSize( 355.5554,300 )
-- tpdframe:Center()
tpdframe:SetPos(ScrW()/2 - 177.7,10)
tpdframe:SetKeyboardInputEnabled(false)
tpdframe:SetTitle("Teleporter")
tpdframe:SetVisible(false)
tpdframe:ShowCloseButton(false)
function tpdframe:OnClose()
tpdframe:SetVisible(false)
end
function tpdframe:Paint( w, h )
if ltp1 == Vector(0,0,0) then ltp1 = LocalPlayer():GetPos() end
local x, y = self:GetPos()
render.RenderView( {
origin = ltp(),
angles = LocalPlayer():EyeAngles(),
x = x, y = y,
w = w, h = h
} )
end
function SWEP:showtdframe(doit)
if LocalPlayer() == self:GetOwner() then if self.tpset then if doit then tpdframe:SetVisible(true) else tpdframe:SetVisible(false) end end end
return true
end
end
There are a few arguments for the ViewData that may work. Maybe try changing znear and zfar?
That's because the server stops transmitting entities that aren't in the player's PVS. Use GM/SetupPlayerVisibility hook on the server.
You will also see that areaportals will still be broken. However, I still haven't found a fix for that other than actually moving the player entity's position.
This was the answer to my problem, thank you so much for bringing this to my attention!
Sorry, you need to Log In to post a reply to this thread.