Hi all!
I always really feel un edged asking a question about something. But I looked everywhere on the wiki :(
I need a hook of some kind, to hook into the rendering, of everything.
A sEnt has a ENT:Draw() function, but what hook/function can I hookinto for things like prop_physics?
Thanks in advance!
You want to draw on ent_physics???
[QUOTE=nettsam;45749810]You want to draw on ent_physics???[/QUOTE]
No, that would be easy.
I want to execute code clienside, within the draw of the prop_physics
Like the ENT:Draw() function that you can deploy on SENTS.
You can't. You can use PostDrawTranslucentRenderables hook though.
[QUOTE=Robotboy655;45750377]You can't. You can use PostDrawTranslucentRenderables hook though.[/QUOTE]
But I need to do things like drawing the model inside this. I don't see a way of retrieving info for every ent?
[lua]
hook.Add("PostDrawOpaqueRenderables", "DrawOnProps", function(depth, drawSkybox)
for k, ent in ipairs(ents.getAll()) do
if (ent:GetClass() == "prop_physics") then
--ent is a prop_physics, do your drawing shit.
end
end
end)
[/lua]
The prop_physics ondraw will overwrite my render frame, as it will always draw a model, even if I don't.
I need to have a way to not draw the model :P.
[editline]21st August 2014[/editline]
I dont think this is possible guys.
Can't you do this?
[code]
ent.RenderOverride = NewDrawFunction
[/code]
[QUOTE=kretorus;45751414]The prop_physics ondraw will overwrite my render frame, as it will always draw a model, even if I don't.
I need to have a way to not draw the model :P.
[editline]21st August 2014[/editline]
I dont think this is possible guys.[/QUOTE]
Use SetNoDraw when you want to hide it.
Unless I'm misunderstanding what it is you want to do, it works fine.
[code]
local mat = Material( "models/debug/debugwhite" )
concommand.Add( "testdraw", function ( ply )
local trace = ply:GetEyeTrace().Entity
if IsValid( trace ) and trace:GetClass() == "prop_physics" then
trace.RenderOverride = function ( self )
render.SuppressEngineLighting( true )
render.ModelMaterialOverride( mat )
self:DrawModel()
render.SuppressEngineLighting( false )
render.ModelMaterialOverride()
end
end
end )
[/code]
[QUOTE=Robotboy655;45751645]Use SetNoDraw when you want to hide it.[/QUOTE]
That's serverside.
I need to be able to draw it only for some players, not all.
[editline]21st August 2014[/editline]
[QUOTE=unrezt;45751714]Unless I'm misunderstanding what it is you want to do, it works fine.
[code]
local mat = Material( "models/debug/debugwhite" )
concommand.Add( "testdraw", function ( ply )
I LOVE YOU
local trace = ply:GetEyeTrace().Entity
if IsValid( trace ) and trace:GetClass() == "prop_physics" then
trace.RenderOverride = function ( self )
render.SuppressEngineLighting( true )
render.ModelMaterialOverride( mat )
self:DrawModel()
render.SuppressEngineLighting( false )
render.ModelMaterialOverride()
end
end
end )
[/code][/QUOTE]
I love you
Sorry, you need to Log In to post a reply to this thread.