Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved Compound collider authoring

Discussion in 'DOTS Dev Blitz Day 2023 - Q&A' started by TheOtherMonarch, Aug 23, 2023.

  1. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    791
    Currently all colliders are merged into a single compound collider. The layers are also merged. This creates issues for many use cases. Will we see a way to control the authoring of compound colliders?
     
  2. schembri-unity

    schembri-unity

    Unity Technologies

    Joined:
    Jul 8, 2020
    Posts:
    12
    This is a challenge we are aware of. Could you provide some specific details of what problems you encounter as a result of this and what you'd find most useful in a solution? How would you want to control the authoring in this situation? This data can help us better guide a path forward.
     
    TheOtherMonarch likes this.
  3. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    791
    The issues I have encountered are a few different ones. Anything you want to do on a per entity basis is harder or impossible with compound colliders. Some of this is related also to blobs being inflexible.

    1: Rotating child colliders as separate entities is not possible with compound colliders. This makes it hard to interface with ECS code. Where your logic is generally per-entity, and you have an entity hierarchy instead of a flat compound collider. Complex kinematic behaviors like multi-hinged turrets become difficult.

    2: Often you want to attach hitboxes to a rigidbody but assign a different layer to that collider. In these cases, you want to separate your rigidbody collider from your hitbox colliders in order to keep the hitbox collisions from affecting the rigidbody solver. So, you would want to keep the collider from becoming part of the inertia tensor.

    3: Colliders within colliders. You may want to have colliders within colliders. Right now, this is not supported since all layers are merged. Even if you use the correct layer mask on your raycast the compound collider will not return the correct child collider. Your ray will be intercepted by the nearest bounding child collider.

    I would like to control what becomes part of the compound collider. I think the easiest way would be to have a compound collider authoring component you can edit in the editor. This way you can manually drag and drop add and remove from the compound collider. This would also give you the ability to add multiple compound colliders as components. If a compound collider component is not present, you can default to the current behavior.

    Each entity should only be allowed one compound collider. However, child entities should also be able to have compound colliders. Each rigidbody should only be affected by the inertia tensor and collider shape of the compound collider attached directly to that entity. Rigidbody components in children should have their rigidbody component removed, merged, or preferably disabled only allowing one active rigidbody component on the root entity.
     
  4. schembri-unity

    schembri-unity

    Unity Technologies

    Joined:
    Jul 8, 2020
    Posts:
    12
    All of these are good points and I'll bring them up with the rest of physics team. I don't want to speculate on how / when / if these will be addressed, but I understand where you are coming from.
     
    TheOtherMonarch likes this.