- Home /
Projectiles without colliders or rigid bodies?
Hey guys, I have a player which shoots projectiles. My problem is - If My projectile has a collider it interferes with my player (Due to the fact that it's not flying very fast I find myself capable of jumping on my own projectiles, which is obviously no good), but if I remove the collider or set it as a trigger, I don't really know how to tell the projectile that it just hit something. I could tell something else that it entered the Trigger zone of the projectile, but that's no good, since I want to have all the projectile related code in the projectile itself. I understand there is a way to do this with RayCasting somehow? Can anyone tell me if that's an optimal solution, and if so, where can I find the code for this?
What I need is pretty simple - If you hit something, check if its tag is "enemy", if it is do a piece of code, after you do/don't do the code, destroy yourself. Please answer in C# if you can. Thanks in advance.
Answer by syclamoth · Nov 03, 2011 at 12:00 PM
This is a wonderful opportunity to learn about Layer-Based collision detection! Basically, you put your bullets on a layer which doesn't interact with the player's model, and so you never have to worry about interfering with your own projectiles.
Can you click the tick button? Not enough people actually do that.
Your answer
![](https://koobas.hobune.stream/wayback/20220613031627im_/https://answers.unity.com/themes/thub/images/avi.jpg)