Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Static hierarchy of colliders with conversion

Discussion in 'Physics for ECS' started by Jawsarn, Feb 7, 2020.

  1. Jawsarn

    Jawsarn

    Joined:
    Jan 12, 2017
    Posts:
    239
    I noticed that there is a difference in the scenario of having a hierarchy of colliders (tested with one parent with X children). Where if the parent has a PhysicsBody(marked static), it will cause all the PhysicsCollider component to only end up on the parent, while all children doesn't have any PhysicsCollider, when not having a PhysicsCollider on the parent, the children will keep their physics collider each separatly. Is there any performance difference between these two setups? Or scenarios where you would want to setup as one vs the other?

    As an additional note, it would be nice if there is no additional component or reference to an entity to exclude it after the conversion, right now it creates entities with only translation rotation etc. if using the first approach.
    (Edit 1: noticed you could add a IConvert script to destroy the entity which solves this^^)
    (Edit 2: this fix seem to only work for conversion in scene and not through
    GameObjectConversionUtility.ConvertGameObjectHierarchy)
     
    Last edited: Feb 7, 2020
    florianhanke likes this.
  2. Adam-Mechtley

    Adam-Mechtley

    Administrator

    Joined:
    Feb 5, 2007
    Posts:
    290
    Yes :) I suggest you view my Unite talk starting at 28:58

    The reason we don't do this is because we don't know if the user still wants those as "attachment points" for some other purpose. We could consider adding an option to clean them up
     
    steveeHavok, Jawsarn and florianhanke like this.
  3. Jawsarn

    Jawsarn

    Joined:
    Jan 12, 2017
    Posts:
    239
    Thanks! Makes sense.

    This would be really nice as I see myself using a many gameObjects to represent only colliders.
     
    charleshendry likes this.