Hello.My tags are Player=3rd person controller and Cube=Cube… Ok so I have a script written but there is a problem. The script is for my Player and when he runs into a Cube, The Cube should die(dissappear. But when I run into the Cube my player dies instead of the cube…How can I reverse it so the cube dies when the player runs into it? here is script. (the script is applied to my 3rd person char)
var other : GameObject;
function OnControllerColliderHit (hit : ControllerColliderHit){
It’s quite obvious. You destroy gameObject which returns the gameobject to which this script is attached to. In your case the player. You want to destroy the other object that collided with the player. In other words: hit.gameObject. You just checked the tag name of this object a line above