So I've gone through all the similar questions, but have still been unable to make this work. I'm new and getting the hang of collision detection.
I have a sphere prefab and a target prefab. The spheres are being shot at the target. When the sphere collides with the target I want the target (a 3d game object) to get destroyed.
My sphere prefab currently has a sphere collider with isTrigger checked and a rigid body that uses gravity. My target prefab has a box collider with isTrigger unchecked and a rigid body with use gravity and isKinematic unchecked (since I want the targets to just sit on the screen, not fall down).
This is my code on the sphere's script:
void OnCollisionEnter(Collision collisionInfo) {
Debug.Log("Detected collision between " + gameObject.name + " and " + collisionInfo.collider.name);
}
void OnTriggerEnter(Collider other) {
Debug.Log("Collided with " + other.gameObject.name);
}
Neither debug statement is printing out. Any ideas what I'm doing wrong in the editor?