Search Unity

Gameobject with many colliders (how many rigidbodies to add)

Discussion in 'Physics' started by Toolism, Mar 26, 2015.

  1. Toolism

    Toolism

    Joined:
    Apr 10, 2014
    Posts:
    12
    Hello again guys.
    I have parts of the game level that consist of the level walls and stuff inside like gems and pickup objects. They all use some form of collider (boxcolliders, sphere colliders etc.)

    My understanding is that if they are triggers they are considered static and thus if I move them, this will force the collision tree to be rebuilt which can cause performance issues. To combat this I should add a rigidbody to the objects and set it to kinematic (since I am the one moving the objects around and not the physics engine itself).

    But here is the catch :) If my set object consists of walls, obstacles and objects to pick up should I add a rigidbody for each one of them or should I just add 1 rigidbody at the top of the hierarchy?

    Here is a screenshot of both what a set looks like:


    and this is its object hierarchy :
     
  2. Roni92

    Roni92

    Joined:
    Nov 29, 2013
    Posts:
    225
    If you really want RB on this, use it only on parent object. But with new physx you shouldn't have performance problems with moving colliders without RB. I would say dont add them RB, but if it'll make you happier you can add them :D, no difference