- Home /
No collision detected with 2D rigidbody
I have a ZombieBoy with a circle collider2D and a box collider2D and a RigidBody2D . The player shots energy balls which has a Circle Collider2D and a Rigidbody2D. It is set to trigger. But i have also tried without it set to trigger.
The ZombieBoy has this on its script
void OnTriggerEnter (Collider other)
{
Debug.Log ("Im hit! " + other.name);
}
void OnCollisionEnter (Collision collision)
{
Debug.Log ("Im hit! " + collision.gameObject.name);
}
But i get nothing in the console, and no breakpoints react.
Answer by Key_Less · Jan 03, 2014 at 06:27 PM
Since you are using 2D colliders, you'll want to use:
void OnTriggerEnter2D(Collider2D other)
// and
void OnCollisionEnter2D(Collision2D collision)
O$$anonymous$$G TY THX U HELPED $$anonymous$$EE,TOOO TYTYTYTY O$$anonymous$$G I LOVE U !!! THXTHX THX THX AND THX m8!!!!
Your answer
Follow this Question
Related Questions
Rigidbody2D characters push each other 0 Answers
where to trigger which collision event? 1 Answer
2D platformer. Let player slide under object. 1 Answer
Ignore collision at high velocity. 1 Answer
Unity2D Collision is bugged 0 Answers