- Home /
Bullet Effect (RaycastAll Question)
I have a particle system I use as a bulleteffect. It works pretty good.
But, my scene, for now, only has a floor. And When I shoot at the floor The particle system does the right thing, but when I after I've shot the floor, then shoot up in the air the particle system continues to fire at the ground!
I'm using RaycastAll, and using the hits[i].point to define where the particle system has to send the particle. How can I check if I'm not hitting anything? and then make the particle system send the effect the way I'm facing a 100 meters?
Answer by Cherno · Sep 16, 2014 at 11:50 AM
If you are using RaycastAll, you know you hot nothing when the array of hits is empty, i.e. has a Length of 0.
Then you can just send the particle towards transform.forward of the gun or whatever.
When I shoot the RaycastAll, it saves the hits[i].point, and if I then don't hit anything I just sends the raycast to the last point I hit!
Doesn't make any sense to me. You say if you don't hit anything, you send the raycast towards the last point you hit? Why?
Oh, $$anonymous$$aybe its cuz I used hits[i].point in a variable to instantiate the particle system....
Your answer
Follow this Question
Related Questions
Find closest object with tag 1 Answer
Find children of object and store in an array 3 Answers
[CLOSED]RaycastAll Help 1 Answer
Photon enable/ disable object 2 Answers