ENTITY/RenderOverride

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(improved example description)
m (RenderOverride does not work on physgun_beam)
Line 1: Line 1:
 
{{Hook
 
{{Hook
|Description=Called instead of the engine drawing function of the entity.
+
|Description=Called instead of the engine drawing function of the entity. This hook works on any entity (scripted or not) it is applied on.
  
This hook works on any entity (scripted or not) it is applied on.
+
This does not work on "physgun_beam", use {{HookFunction|GM|DrawPhysgunBeam}} instead.
  
 
{{Note|As a downside of this implementation, only one RenderOverride may be applied at a time}}
 
{{Note|As a downside of this implementation, only one RenderOverride may be applied at a time}}

Revision as of 09:14, 10 September 2017

 ENTITY:RenderOverride( )

Description

Called instead of the engine drawing function of the entity. This hook works on any entity (scripted or not) it is applied on.

This does not work on "physgun_beam", use GM:DrawPhysgunBeam instead.

NOTE

As a downside of this implementation, only one RenderOverride may be applied at a time

Examples

Example

Set the entity the player is looking at to not draw if the player is its owner.

local function DontDrawMe( self )
	if ( self:GetOwner() == LocalPlayer() ) then
		return
	end
	
	self:DrawModel()
end

local pickent = LocalPlayer():GetEyeTrace().Entity

if ( IsValid( pickent ) ) then
	pickent.RenderOverride = DontDrawMe
end


Personal tools
Navigation