Can Rigidbody 2D collide with 3D Colliders?

Reading the extra details that this page talks about the colliders, http://docs.unity3d.com/Documentation/Components/class-Rigidbody2D.html, it seems that this 2d Rigid body can only collide with other 2D objects and not 3D objects. I've tried to make the player using a rigid 2d body collide with the regular 3d box collider but it keeps passing through. It does collide with the 2d box collider object below so I know I'm using the rigidbody 2d correctly at least.

Does anyone have any input on this?

2 Replies

 · Add your reply
avatar image
11

Answer by MiaN KhaLiD 

I stumbled upon this issue myself recently, and have found out that its not possible for a 2D object to collide with 3D object and vice versa. Reason being unity uses PhysX for 3D and Box2D for 2D, which are exclusive of each other.

So what options do we have, if we want a hybrid

There are 2 ways we can achieve collision between the 2 systems:

  1. To your 3D object add an empty game object as a child, with RigidBody2D (GravityScale set to 0) & a BoxCollider2D matching the width of the 3D Object. Then receive the collision event in the OnCollisionEnter2D(Collision2D collision) function.

  2. Or you can add a RigidBody and a 3D Collider (say BoxCollider) to your 2D object and receive the collision event in the OnCollisionEnter (Collision collision) function.

Hope it answers the question :)

avatar image
0

Answer by J0hn4n 

Or just make 2 childs one to handle 2d collision events and another one to handle 3d events, EZ. another alternative its just handle your own system already if you dont need physic its EZ too.


ref : https://answers.unity.com/questions/580769/can-rigidbody-2d-collide-with-3d-colliders.html

+ Recent posts