Using OnCollisionEnter with cube

Hi I am using OnCollisionEnter with a cube, but anytime the player(Which is just a capsule for now) touches the cube nothing happens. I am looking the cube to be destroyed whenever the player touches it.
Both the player and the cube have ridge bodies, both of them do not have is Kinematic checked.
Any help would be great :slight_smile:

void OnCollisionStart (Collision col)

{

if (col.gameObject.name == "PlatformBroken") 

{		
Destroy(col.gameObject);

}

}

Instead of:

void OnCollisionStart (Collision col)

Use:

void OnCollisionEnter(Collision col)

Hope it works.

~NightmarexGR

Collider : Unity - Scripting API: Collider

  • OnCollisionEnter OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
  • OnCollisionExit OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.
  • OnCollisionStay OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.
  • OnTriggerEnter OnTriggerEnter is called when the Collider other enters the trigger.
  • OnTriggerExit OnTriggerExit is called when the Collider other has stopped touching the trigger.
  • OnTriggerStay OnTriggerStay is called almost all the frames for every Collider other that is touching the trigger.

OnCollisionEnter : Unity - Scripting API: Collider.OnCollisionEnter(Collision)

Description : OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.

Note that collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached.

^^ is this true for your objects?