How to use 2D physics for 3D models

Hello. I’m making a game that uses 3D models, but to increase performance I planned on using 2D physics. However, when I try to add a BoxCollider 2D it doesn’t show up in the scene, and I get the error “The collider did not create a collision shape as it failed verification. This could be because it was deemed too small or its vertices were too close. Vertices can also become close under certain rotations.”

I tried making my model bigger, but that didn’t solve the issue. Do I have to use 3D physics for 3D objects?

[edit] I’ve found a really hacky work around. If use 3DSMax to render a png of the model, then attach a sprite-render to the object, create the 2d physics polygon, then delete the sprite-render I get the desired results. Surely there is a better way of doing this?

[edit2] I found the reason this is happening. When applying a BoxCollder2D to a 3D object, unity seems to take a flattened image of the object from the Z plane (that is to say, with Y being vertical and X being horizontal) but I was rotating my objects by 90 degrees, making that plate on which it’s trying to make the collision box flat:


(worked on the left, error on the right)

I’m still not sure how to fix this, but at least I have something to work from now. I guess I could open the models in 3D studio and rotate them there, then export them again.

You should be able to add a 3D object as a child of a RigidBody2D. At worst case you can attach a script to your model that makes it follow the RigidBody2D. You will probably have to build custom colliders to get it to match your model.

In terms of performance I don’t think you will end up gaining much, if anything. I’m only listing this as a solution because I can come up with a couple of cool concepts using a 2D game with 3D graphics, or vice versa. But you need to build it in as a designed mechanic, not a performance boost.

Edit: Apparently so.

Sounds like the scale of the model is way off. The box collider should ideally be about 1 unit in size.