- Home /
Using your own mesh for collision?
I have made my own mesh in an external 3d application and a physics mesh to go along with it, but how can I use that phys mesh in unity? Mesh Collider thingy seems to generate it's own model instead of using mine.
Answer by 3DMagicVR · Jan 31, 2011 at 07:46 PM
Hi, try this:
Enter in the model you got on the hierarchy panel and add a Mesh Collider to the model not to the root and if you got a collider on the root eliminate it, this way you can use your own mesh for collision, but one thing, mesh collider with mesh collider don't generate any collision.
Your object hierarchy must be like this on the hierarchy view: 3D Object Name > Bones, Mesh 1, Mesh 2, etc.
Answer by Borgo · Jan 31, 2011 at 07:52 PM
The mesh collider can be used in 2 ways:
1 - non-convex: in this case, it will use your mesh to generate collisions, the problem is that you can't do collisions between non-convex colliders.
2 - convex: in this case, it will generate a collider that will interage with others convex mesh colliders, but, the mesh can't be more than 255 triangles and will not cover your mesh at all, instead, it will create a convex form of your mesh. Just active this options and see in the scene viewer, it will change the collor to green.
See the documentation:
http://unity3d.com/support/documentation/Components/class-MeshCollider.html
So it's not possible to have custom collision on an object that will actually move? That sucks badly.
@Johan: If you're referring to the convexity limitation, then that's fairly standard (collision detection and resolution between multiple arbitrary non-convex objects is highly non-trivial). If you mean something else though, perhaps you could clarify.
the mesh collision slow down too much performance. Even best cars simulation games uses basic colliders, you can create a variety of colliders and group then to make a "custom collider".