I have a ball that falls thru a hole. The hole is part of a base which has a reasonable depth which means the ball will hit the sides of the hole as it falls thru. The base has a mesh collider (maybe this will be changed to a box if possible in the future) and the ball has a Rigidbody.
I am not interested in this collision (I mean I don’t have any scripts that look for it at all) but the slowdown is quite surprising and although I have not yet looked at the frame rate difference the other objects in the game stutter a lot then slow.
Any thoughts on how this can be changed so it is less of an impact?
(bearing in mind it will be difficult to change to a box collider given that its a hole in a base). No gui stuff in here either.
Yes, don’t use mesh colliders. Even if you don’t have code to respond to the collision the detection routines are still running and mesh colliders are expensive. So switch to box colliders and/or disable the colliders altogether while this is happening.
You used the key phrase, “mesh collider”. Don’t use 'em, simple as that. Box colliders for example are very simple and computationally light as it’s easy to determine the bounding volume, anything that needs to compute a mesh’s bounding volume and check for collisions will get VERY expensive VERY fast.
BTW: I meant Convex Mesh Colliders, not Compound (But I think you understood that).
Hmm… i dont really think I have a choice as my levels are not uniform enough to allow for box colliders… i would need to add 100+ to get even a close approximation.
Example…
Obviously, I can remove the ground mesh, and put a box collider there, but the walls and platforms are too tricky to fit compound colliders… unless someone has a good suggestion for me?
There’s no rule saying you can’t use them, but if you’re like the OP and you start asking about performance lags that seem associated with mesh colliders then you know where to start looking first.