• Does anyone know how to make an Spotlight Style Light?
    5 replies, posted
Does anyone know how to make an Spotlight Style Light. I already tried to implement the Gmod Lamp but i didn't work garrysmod/gmod_lamp.lua. Is there a way to do the same with an Dynamic Light or something like that already tried to adjust the innerangle and outerangle of the Dynamic Lights but no Sucess. https://files.facepunch.com/forum/upload/301280/899ac6f8-a7ee-4d61-bea2-81dc5d749503/Screenshot_21.png The Light should shine out like normal Headlights.
GMod lamp is what you are looking for, if "it didn't work" then you did it wrong.
Post your code and we can try to see why it didn't work, but as Rubat said, a lamp is what you are after. Dynamic lights work more like a light-bulb with an area of light.
So here is the Code Snipptet im tryin around with: flashlight = ents.Create( "env_projectedtexture" ) flashlight:SetLocalPos( Vector( 0, 0, 0 ) ) And thats the Error i get: [ULib] addons/ivsystem/lua/autorun/ivsystem_main.lua:152: attempt to call field 'Create' (a nil value)   1. fn - addons/ivsystem/lua/autorun/ivsystem_main.lua:152    2. unknown - lua/ulib/shared/hook.lua:109 Any Idea why i can't create "env_projectedtexture"?
Looks like you are trying to run it in a shared file. ents.Create is a server-side only function. I'm not 100% sure because i've not used it before but ProjectedTexture might also suit your needs.
Hey that works good. But there is one Problem left. The Lamp Light is rendering way too long, even when im deleting it through every frame in think. local lamp = ProjectedTexture() lamp:SetTexture( "effects/flashlight001" ) lamp:SetFarZ( 250 ) render.DrawSprite( pos+ obj:LocalToWorld(Vector(105,15,5)), size2, size2, white ) lamp:SetPos( pos+ obj:LocalToWorld(Vector(105,15,5) )) lamp:SetAngles( obj:LocalToWorldAngles(Angle(0,0,0)) ) lamp:Update()
Sorry, you need to Log In to post a reply to this thread.