- Home /
Gun Light help how to do?
Hey people, i'm brazilian like my name '-' and i don't speak english so good but i need help. I don't know that name... i think that is ray light, that raylight in the begin the gun when shoot, i don't know if you understand. If you don't look that in google translator to portguese:
Olá pessoal, quero saber aquela luz que fica no início da arma quando atira, e preciso desse código em javascript.
plz i need this code in javascript!!!! maybe the name is gunfire
and I need you to write me a game please thanks.
watch this tutorial before you post again!!!
who was the idiot again to let this through the mod queue?
Answer by Cherno · Nov 08, 2013 at 02:07 PM
It's called muzzleflash.
You just instantiate a light gameobject and destroy it after a fraction of a second. Alternatively, you can create it before game start, disable the light, store it in a variable so it can be accessed, and then when the gun fires, quickly enable and disable it. A common way to achieve the desired effect is to combine the light with a muzzleflash model or particle system so the muzzleflash can be actualy seen instead of just lighting up the scenery.
There are a number of threads and tutorials for creating a muzzleflash.
http://answers.unity3d.com/questions/128921/Muzzleflash-Question.html http://answers.unity3d.com/questions/172968/Gun-Muzzle-Flash.html http://answers.unity3d.com/questions/177661/Instantiating-Muzzle-Flash.html http://answers.unity3d.com/questions/216089/How-to-make-and-use-a-muzzleflash.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613121445im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Machine Gun Script :) 1 Answer
How to resume animation where it left off? 3 Answers
Making a gun shoot 1 Answer