Entity.SetMaterial

From GMod Wiki

Revision as of 20:27, 9 March 2011 by Toneo (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.SetMaterial]Entity.SetMaterial [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCreates an entity with rendered with the blue glow at the Player.GetShootPos of the player.
Used onNewerServer.png
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( )
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox