Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    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.