Search Unity

Tradeoffs bw concave & convex meshes, and primitive colliders, & tons of children vs one mesh.

Discussion in 'Physics' started by Tudor, May 22, 2018.

  1. Tudor

    Tudor

    Joined:
    Sep 27, 2012
    Posts:
    150
    Instead of using one complex concave mesh collider, or many convex mesh colliders, I decided to use 30 capsule colliders. They are all under one rigidbody.

    On the surface it appears unity does not group or optimize child colliders, but rather just bubbles up each `OnCollisionenter` call individually to the parent rigidbody.

    What's the tradeoff point performance wise? For example what's the better practice: having a mesh collider of a donut, or a donut made of spheres?

    Furthermore, what's the precision difference between a concave mesh collider, a convex mesh collider, and a sphere collider. In other words, what internal systems does Unity use for collision solving in each case?
     
    Last edited: May 23, 2018
  2. Artaani

    Artaani

    Joined:
    Aug 5, 2012
    Posts:
    423
    Firstly, non-convex mesh colliders can't be used on non-kinematic Rigidbody. So if your donut is dynamic, you can't use mesh collider on it, You should use several smaller colliders anyway.

    However there is 2 options:
    1. Multiple components on the the donut
    2. Multiple collides as children

    And in my opinion, first variant is better, because movement of children also requires CPU computations.
    Here is my tests:
    https://forum.unity.com/threads/imp...reduces-a-performance-pictures-inside.392084/