- Home /
Question by
Lautaro-Arino · Jan 07, 2014 at 05:39 PM ·
2dcollision
No OnCollisionEnter with 2D colliders?
I cant get OnCollisionEnter to work with objects with 2D colliders and Rigidbody2D. OnTriggerEnter works if collider set to trigger.
This object has 2D Colliders and a RigidBody2d. The colliding object as well.
void OnCollisionEnter (Collision collision)
{
print ("Zombieboy Collision");
var x = 0;
switch (collision.gameObject.name) {
case ("Martha(Clone)"):
arrivedAtTarget = true;
print ("Gotcha");
break;
default:
break;
}
}
Comment
Best Answer
Answer by Statement · Jan 07, 2014 at 05:44 PM
It's `OnCollisionEnter2D`, I think (I haven't used the 2d collision system yet).
Check the Messages section of Collider2D for details.