ProjectedTexture
Örnek
Bir Scripted Entity'ye bağlı basit bir ProjectedTexture oluşturur.
Bu kodun paylaşımlı (shared) değil, sadece istemci tarafında (clientside) çalıştırılması gerektiğini unutmayın.
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
local pos = self:GetPos()
local angles = self:GetAngles()
if ( IsValid( self.lamp ) ) then
self.lamp:SetPos( pos )
self.lamp:SetAngles( angles )
self.lamp:Update()
else
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( pos ) -- Initial position and angles
lamp:SetAngles( angles )
lamp:Update()
end
end
Tüm sunucular · GmodTR Launcher · Rehber · GMod Wiki · GmodTR nedir? · Sunucu ekle · Discord