Search Unity

Feedback (pure ECS) We have zero parenting examples

Discussion in 'Entity Component System' started by gnostici, Apr 12, 2020.

  1. gnostici

    gnostici

    Joined:
    Jul 27, 2013
    Posts:
    23
    The archetypes are as follows, to show I have the required components:

    Code (CSharp):
    1.         quadArch = eMan.CreateArchetype
    2.             (
    3.                 typeof(RenderMesh),
    4.                 typeof(RenderBounds),
    5.                 typeof(LocalToWorld),
    6.                 typeof(LocalToParent),
    7.                 typeof(Translation),
    8.                 typeof(Rotation),
    9.                 typeof(QuadSprite),
    10.                 typeof(Parent)
    11.             );
    12.  
    13.         quadPare = eMan.CreateArchetype
    14.             (
    15.                 typeof(Translation),
    16.                 typeof(Scale),
    17.                 typeof(Rotation),
    18.                 typeof(LocalToWorld),
    19.                 typeof(QuadParent)
    20.             );
    I move the parent to the same position I would move the entities to one-by-one without the parent. In the latter case, they render. After positioning the parent, my quads remain at 0,0,0 with no rotation, a default LocalToWorld identity matrix, and everything else is all zeroes. If I move the child entities (even to 0,0,0), then LocalToParent changes to the parent's world position. But the quads still do not move to 0,0,0 relative to the parent. And they don't render. If I move them exactly as I would without the parent, I get the same result. If I comment out all the code related to the parent, they move and render perfectly.

    I've been at this all day, and from everything I've read, these quads should be following the parent to the same place they'd be without the parent; considering the parent is transformed exactly as they were. I can find no hierarchical transformation examples at all. In the documentation, there's explanation, but no examples of anything. Regarding parenting for transformations, absolutely all I can find is people saying it works.

    And I don't even know for sure what to ask, after more than 12 hours of this. Even the cookbook has absolutely nothing whatsoever about this.

    Can we please, please get something demonstrating how to set this up? What do we inherit from? Is it still SystemBase? How would we inherit from ParentSystem when the type cited in the documentation (JobHandle) doesn't exist? Should that be the name of a specific job handle? And if we're scheduling all the coordinate conversions, why is there a parenting system at all in the first place? Does it actually do anything?

    Is this simply not working, despite the claims it works? Does it only work in hybrid ECS? If so on either case, why is it documented as if it's functioning?
     
    Last edited: Apr 12, 2020