I'm trying to use a mesh collider on the player's avatar, rather than the box collider.

I've added the mesh collider to the game object (which also has a rigid body) and selected the "convex" checkbox. However, the player still falls through all geometry, including Unity primitives, terrain, and other models.

In the mesh collider's property box, there's a value for "Mesh", which I have set to "None (Mesh)". I was led to believe this defaults to the model's own mesh, but now I'm not certain. If I change the value to something else from the "select mesh" list, like the cube, the collisions work. When I click over to Select Mesh --> Scene, the list is empty. I'm assuming I need to add the model's mesh to the list, but I can't find any documentation about that.


Did some trial and error.

The mesh collider has to be added to the actual mesh object, not the game object that contains the mesh.

For example, if you have player_car, which contains a car_mesh, a camera, and whatever else you need, then the mesh collider has to be added to car_mesh and not player_car.

If you created your object by dragging the model into the scene, then the game object and mesh object likely are one and the same. However, if you needed to create a more elaborate hierarchy (like I did), then you'll need to be more careful about where the collider goes.

Apparently a box collider can just be put any old place since the dimensions are user-defined.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.