- Home /
Problem with collisions
Hey guys, I'm having an issue with making an object I'm colliding with disappear.
Here is my code
function OnCollisionEnter(collision : Collision){
if (collision.gameObject.tag == "M-Inc") { Destroy(collision.gameObject); ++rigidbody.mass; }
}
It works when the object I'm colliding with falls onto the player object, but when I run into that same object, nothing happens.
Questions: 1. Do you want anything that collides with the PLAYER to destroy? 2. If so, are the objects you want destroyed to have a certain tag? OR! 1. Do you want anything that has this script and collides with the player to destroy?
I want everything with a certain tag to be destroyed when it touches the player.
Your answer
Follow this Question
Related Questions
Destroy object on touch of object with specific class 3 Answers
Creating a Asteroid health script 5 Answers
How to make two objects collide using "Is Trigger" 1 Answer
On Click, destroy object and any colliding object with the same tag. 6 Answers
Network.Destroy and collision; destroying correct object. 1 Answer