Colliders (partly) inside eachother..

Hi,

Is it a bad idea to place colliders like 2 box colliders (with a parent GameObject which has a rigidbody attached) partly inside of eachother or doesn't this matter.. performance wise ?

Thanks.

No, I don't think it's a bad idea.

I almost always overlap my primitive colliders when using them to form compound colliders in this way. In addition, the example of compound colliders on this manual page clearly shows a number of primitive colliders overlapping to form the approximate shape of the rendered mesh. So, I'm pretty certain this is the intended use, and as such, not a bad idea at all!

I haven't done any performance tests but my hunch is that the performance difference between overlapping vs. same colliders non-overlapping would be negligible to unmeasurable.

It makes no difference if it's only a few so go ahead. Unless you have hundreds of little colliders then you might want to combine some.

The general rule is that little gaps and thin ledges (or anything that has drastically-changing directions in shape) are generally undesirable for physics calculations and might affect performance negatively. In short, overlaps that don't generate thin ledges are good for you in every sense, even performance wise. Exception would be if the overlaps are 100% coincident of course, since that's just a waster of resources. Go for common sense and you'll be safe.

Good luck!