Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to create nested collider hierarchy

Discussion in 'Physics for ECS' started by LudiKha, Jul 3, 2020.

  1. LudiKha

    LudiKha

    Joined:
    Feb 15, 2014
    Posts:
    140
    I'm trying to set up a hierarchy whereby a root entity has a dynamic physics body and shape, and a child entity has a trigger collider that follows the parent transform.

    Currently it appears that all child shapes are combined in a compound collider, which makes this impossible to set up in the conversion workflow.

    Any ideas on how to achieve this?
     
  2. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    What is your use case for this? Maybe I could suggest an alternative if I knew what exactly you are trying to achieve.

    Having a compound collider with one regular collider (your shape you mentioned) and a trigger collider seems like it could do the trick. They would be "equal" in the hierarchy, but you would still have one shape and one trigger.

    Now the entity would be on the root of the compound collider, as well as the body, and you wouldn't have entities for each shape in the hierarchy.
     
  3. LudiKha

    LudiKha

    Joined:
    Feb 15, 2014
    Posts:
    140
    Hi @petarmHavok , thanks for the reply.

    I seem to have misunderstood how compound colliders work. I didn't know they retained their unique collision filters and other properties.

    This will work fine for my use case - I will just have to do the trigger events filtering for the root entity.
     
    petarmHavok likes this.