Entity.SetMaterial
From GMod Wiki
Function | |
Syntax | Entity:SetMaterial( String material ) |
Description: | |
Sets the override material for the model. This is also used by the material tool in the toolgun. | |
Returns: | nil |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.SetMaterial]Entity.SetMaterial [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Creates an entity with rendered with the blue glow at the Player.GetShootPos of the player. |
---|---|
Used on | |
Code | ent = ents.Create( "prop_physics" ) ent:SetModel( "models/Weapons/w_bugbait.mdl" ) ent:SetMaterial("Models/effects/splodearc_sheet") ent:SetPos( self.Owner:GetShootPos() ) ent:SetAngles( self.Owner:GetAngles() ) ent:SetOwner( self.Owner ) ent:Spawn( ) |
Output | N/A |
Additional Notes
- The path's root is in the materials/ folder. File extensions like .vmt or .vtf are not included. An example path is "models/shiny".
- Set material to "" in order to revert to the normal material of an entity. It is also possible to do this with many models by setting the material to the model string.