- Home /
Emit beam and collide
I'm confusing myself.
Can I emit a beam (like a round, thick laser beam, but growing) from an object and add a colider so that if that beam hits anything, it plays my kaboom animation and stuff?
Cause I cant find anything regarding the above in the settings of the line renderer?
Thanks!
Answer by Justin Warner · Mar 26, 2011 at 08:43 PM
Use a particle system, when you shoot, make one particle, then keep doing it while the key is down, and if it colides, you can do the animation... Can do this with ray casting or just OnColisionEnter.
Hope this helps!
Check this out: http://musegames.com/contest/?batch=2#entries
Thanks Justin! Will try, I'm just careful of particles as they tend to slow down things
Also, as Dave said, you can do the cylinder, and I thought Unity came with a glowing shader? I might be wrong, but I don't think I am.
Answer by DaveA · Mar 26, 2011 at 09:34 PM
You should be able to do that. Using a cylinder mesh, and scaling the height of it (assuming you would do it slowly enough to register the collision). If you want speed-of-light hitting, use a Raycast. In fact, I'd just do that anyway.
Thanks DaveA, will also give it a shot, the idea is to have a slowish, but not too slow beam, but you must be able to see it move with the eye.
Ah like 'lasers' in so many Sci Fi shows, right? You'll probably need to scale it 'out' as it comes out of the gun, and 'in' as it hits the target.
Your answer
![](https://koobas.hobune.stream/wayback/20220613115035im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make objects collide and move each other? 2 Answers
basic cylinder with capsule collider 1 Answer
Collision with terrain 0 Answers
on trigger Enter 1 Answer
Dive collide 2 Answers