Garry's Mod Wiki

Garry's Mod Wiki

  ProjectedTexture ProjectedTexture()


Creates a new ProjectedTexture.


1 ProjectedTexture
Newly created projected texture.


Creates a simple ProjectedTexture attached to a Scripted Entity.

Note that this code must be ran on clientside only, not shared.

function ENT:Initialize() local lamp = ProjectedTexture() -- Create a projected texture self.lamp = lamp -- Assign it to the entity table so it may be accessed later -- Set it all up lamp:SetTexture( "effects/flashlight001" ) lamp:SetFarZ( 500 ) -- How far the light should shine lamp:SetPos( self:GetPos() ) -- Initial position and angles lamp:SetAngles( self:GetAngles() ) lamp:Update() end function ENT:OnRemove() if ( IsValid( self.lamp ) ) then self.lamp:Remove() end end function ENT:Think() -- Keep updating the light so it's attached to our entity -- you might want to call other functions here, you can do animations here as well if ( IsValid( self.lamp ) ) then self.lamp:SetPos( self:GetPos() ) self.lamp:SetAngles( self:GetAngles() ) self.lamp:Update() end end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...