I know that unity physics support only convex mesh colliders on rigidbodies, but sometimes you do need two or three of them, for a hook or some kind of container, but adding multiple convex mesh colliders to a rigidbody causes strange behaviour: it seems that friction is applied multiple times (maybe it applies for every mesh collider component?) and objects fall and move a lot slower if they contact any other collider even at small point. It looks odd to see slow-motion objects near to a normal ones with only one mesh collider or basic shapes collider. Talking about basic shapes colliders, no, they don’t have such problems as far as I can tell, or maybe they are just a lot less visible. Maybe my settings are wrong or something, but I would appreciate any information on this topic and share my setting or footages if needed!
Generally it’s best to avoid MeshColliders in production. They are relatively slow and just one tiny vertex displacement causes the whole thing to no longer be convex, and then you get all sorts of weirdness. And it’s often hard to debug/notice.
Try to construct your collider using multiple primitive colliders. There are assets in the store that help make this easy.
This is true and I am often trying to avoid mesh colliders, but sometimes rigidbody objects has a really complex geometry, like a tripod with angeled legs, which are actually hard and not very practicle to construct with primitive colliders. And what do you mean by
There is a checkbox that converts a collider into a convex one.
Yes, the collider mesh will be convex but it can take on a weird and sometimes unexpected shape, and it may make the collision mesh more complex. It helps to show the collider mesh in the scene view when toggling the checkbox to see how this alters the collision mesh.
That’s not true at all. MeshColliders are perfectly fine to be used in production. In a vast amount of situations, turning every MeshCollider into convex or primitive colliders is simply not practical. When there are issues, they surely don’t come from the MeshColliders themselves, but with the way / settings / situation they’re being used.
For example: for the collision mesh of a static scenario, instead of having one large MeshCollider, a better practice to split it into smaller pieces (actual example of extensive use of MeshColliders in production).
This situation is perfectly supported by the physics engine. It’s the so called “compound collider”, and it’s the correct way to have dynamic objects with concave parts (i.e. cargo vehicles).
The issues are not related with having multiple convex mesh colliders in a rigidbody, but with the collision settings, read below.
This is surely caused by the Rigidbody’s Collision setting being Continuous Dynamic. Try setting Collision = Discrete in the Rigidbody. It has been reported that, after an upgrade in PhysX 4.1 in Unity 2022, the Continuous Dynamic collision mode started working weirdly.
As for my experience, I recommend these settings for collisions and frictions in Unity:
- Rigidbody > Collision: Discrete (unless other setting is specifically required and tested against issues).
- Project Settings > Physics:
- Solver Type: Projected Gauss Seidel
- Friction Type: Patch Friction Type
- Improved Patch Friction: Enabled
- UPDATE: Enable Adaptive Forces: Disabled
References and examples:
You’re right. I tend to think of different games/use-cases and “lazy” asset publishers that leave the default MeshCollider on everything, even small props like cans, bullets, pens, dice, etc. I’ve seen this cripple performance just too many times.
UPDATE: Adaptive forces DO NOT mix well with multiple mesh colliders, I should have tested this earlier… ![]()
Thank you for pretty detailed responce, but this does not seem to do the trick: https://youtu.be/ZHXzRP-ffM8
(Yes, I know that this is just stupid to add that much colliders to a simple bucket, but this is just an example to see effect better, because more colliders → more friction? slower movement? I don’t really know how to describe, because when it isn’t touching any colliders it acts normally.
Good point! I’ll add this to my recommended physics settings.
Adaptive Forces is essentially a hack designed to stabilize large piles of objects. As a result, the actual contact forces are artificially adjusted to suit those situations, making them less physically accurate in other cases.