Hi,
I am trying to destroy the player upon colliding with a game object cube named Death.
I attached rigid body to both the player and Death. Also added capsule collider to player and box collider to death . My player rigid body has kinematic and use gravity checked.I attached the script to Death.
The code I used was -
using UnityEngine;
using System.Collections;
public class Destuction : MonoBehaviour
{
void OnCollisonEnter(Collision col)
{
if(col.gameObject.tag == "player")
{
Debug.Log ("You have been destroyed by death");
Destroy(col.gameObject);
}
}
}