Best way to get 2D character to collide with a meshcollider?
As known MeshCollider cannot collide with 2D colliders.
I'm trying to figure out a good way of checking if my 2D character collides with the meshcollider.
What would be the best way to do this?
Currently it has a 2D box collider, and a RigidBody2D.
Regards, Shady.
Answer by brunocoimbra · Jan 28, 2016 at 12:28 PM
As yourself said: MeshCollider CANNOT collide with 2D Colliders.
Having said that, you still have 2 options:
Utilize only physics 2D or physics 3D (chosse what fits better to your game). For that, you can create a full 2D game only with 3D physics, or you can trade your mesh collider for polygon colliders (you can create almost infinite points in the polygon collider, but it's limitation comes to it being immutable).
Just add an empty gameobject with a 2D collider as a child of the mesh object, or add an empty gameobject with a 3D collider as a child of the 2D object. I would not reccomend that, as you probably will not need the the 3D collider if your game is mostly 2D, as a mostly 3D game will find 2D collider useless.
Summing up:
If you are developing a 2D game and your mesh object doesn't have an animation (like walking), just put a polygon collider on it.
Else, just put 3D colliders in everything and turn on the constraints to adjust it to your game.
There is no real reason to have both 2D and 3D physics, but nothing can stop you from doing that.
Ended up removing the rigidbody 2D and using a normal rigidbody and a boxcollider so i can walk around on the terrainmesh =). Thanks.