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*.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?*

Your code please.

1 Answer

1

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*.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, Maybe its cuz I used hits*.point in a variable to instantiate the particle system....*