Skip to main content
2 of 3
added 45 characters in body
eren_tetik
  • 451
  • 1
  • 8
  • 17

How to ignore collision between two objects

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

eren_tetik
  • 451
  • 1
  • 8
  • 17