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.