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

Page Links

Special Pages



Render Time: 35ms

DB GetPage 4
Generate Html 7
SaveChanges (1) 15
Render Body 0
Render Sidebar 7