Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Question How to get colliderkey or another unique collider in bake stage?

Discussion in 'Physics for ECS' started by xacce, Nov 30, 2023.

  1. xacce


    Nov 10, 2013
    Okay, now I'm frustrated(
    In games, you have to change colliders at runtime. For example - disable response policty or change collision filters.
    Ok, you have an api for that. But the handling of it is saturated with ColliderKey all over the place.

    To get colliderkey it is necessary to simulate the whole stage of physics baking and then you may have it, but it is obviously not the option I would like to use.

    In the CompoundCollider api there is a magic ConvertChildIndexToColliderKey and child index here is an index in the array of already sorted colliders and in general to get this index is also problematic and therefore I can not rely on this option

    And here I have a question: how to do it? How can I get a stable collider identifier (ColliderKey) at the stage of baking, so that I can change its behavior further on in runtime?