Something like SetViewEntity in Derma?

Hello, I’ve been wondering for a while how to create something like how SetViewEntity (https://wiki.garrysmod.com/page/Player/SetViewEntity) but in a smaller/scaled form inside a derma panel.

I’ve messed around with some render target stuff, but wasn’t able to create any result without outputting errors. (I’m also trying to keep the players view the same, but the panel’s “image” would keep the entities view)

Any help/insight would be great.

Try this:



local f = vgui.Create( 'DFrame' )
f:SetSize( 500, 500 )
f:Center()
f:MakePopup()

f.Paint = function( self, w, h )

    local x, y = self:GetPos()

    render.RenderView( {
        origin = Vector( 0, 0, 0 ), -- change to your liking
        angles = Angle( 0, 0, 0 ), -- change to your liking
        x = x,
        y = y,
        w = w,
        h = h,
    } )

end


Seems to work for me (I feel actually smart for working that out for some reason)

More RenderView stuff you can set

I added this as an example for the ViewData wiki page :stuck_out_tongue: