How do I change how a client-side entity is drawn?
2 replies, posted
How do I change how a client-side entity is drawn? I can't mess with its model in ENT:Draw() because its not a scripted entity. I'm creating it with ents.CreateClientProp([model name]). Like, for example, what if I wanted to make a SWEP that draws a model with increasing size wherever I shoot? I know how to change a model's size using EnableMatrix(), but I would normally do that in its draw hook (which I can't do). Please help. Thanks!
You could always manually draw the entity in whatever render hook you so desire.
[lua]local e = ents.CreateClientProp( "models/error.mdl" )
e:SetNoDraw( true )
hook.Add( "PostDrawOpaqueRenderables", "Draw Our Entity", function()
e:SetRenderOrigin( someVec )
e:SetRenderAngles( someAng )
e:SetupBones()
-- Other rendering stuff you want to apply before drawing
e:DrawModel()
-- Cleanup
e:SetRenderOrigin()
e:SetRenderAngles()
end )[/lua]
OOOooook! That helps! Thanks! :)
Sorry, you need to Log In to post a reply to this thread.