Garry's Mod Wiki

ENTITY:RenderOverride

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.

As a downside of this implementation, only one RenderOverride may be applied at a time.
Drawing a viewmodel in this function will cause GM:PreDrawViewModel, WEAPON:PreDrawViewModel, WEAPON:ViewModelDrawn, GM:PostDrawViewModel, and WEAPON:PostDrawViewModel to be called twice.
This is called before PrePlayerDraw for players. If this function exists at all on a player, their worldmodel will always be rendered regardless of PrePlayerDraw's return.

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

Page Links


Special Pages


Wikis

?

Render Time: 36ms

Session 0
DB GetPage 3
Generate Html 9
SaveChanges 9
Render Body 0
Render Sidebar 12