Search Unity

Why Use a Static Physics Body?

Discussion in 'Entity Component System' started by gilley033, Jun 5, 2019.

  1. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,191
    What is the purpose of having a Physics Body with Motion Type set to Static? Wouldn't removing the Physics Body simply serve the same purpose?

    The only thing I can think of is if you have a collider that needs to be static for some time but then will start moving at some point. In this scenario, is it cheaper to change the body from static to dynamic and back again vs removing/adding the Physics Body component?

    Edit: After posting I realized this probably should have been posted in the physics discussion thread. I'm honestly not sure why I thought I needed to create a new thread . . . Sorry!
     
  2. Shinyclef

    Shinyclef

    Joined:
    Nov 20, 2013
    Posts:
    505
    So other bodies can interact with it. E.g. Perhaps you have a tree or a rock.
     
  3. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    It groups all static colliders into a single entity using a compound collider. As opposed to each collider having its own separate entity.
     
    eterlan likes this.
  4. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,191
    So you mean all static colliders in the scene, or all static colliders that are children of a parent that has a Physics Body component?
     
  5. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,191
    If you have a static object with a Physics Shape but no Physics Body, other Physics Bodies can interact with it.
     
    Shinyclef likes this.