How to ignore collision between two objects

Posted by eren_trigger on Game Development See other posts from Game Development or by eren_trigger
Published on 2014-05-29T09:08:59Z Indexed on 2014/05/29 9:44 UTC
Read the original article Hit count: 242

Filed under:
|

I have a player that shoots in the direction that it is facing. However, the shot that is created when I click, also destroys the player. How would I make the shot ignore collision with the player? Or better yet, how to make a shot destroy anything it touches and destroy itself without affecting the player?

This is the code that controls collisions: function OnTriggerEnter (col : Collider) { Destroy(col.gameObject); }

The shot is a trigger, but the player isn't. Not sure if this changes anything in this case.

Thanks in advance.

EDIT: http://gfycat.com/TediousAridFeline

© Game Development or respective owner

Related posts about unity

Related posts about JavaScript