I'm making this an issue since there's still no examples online that I've seen of
EnTT scene graph implementation with parent-child transform dependencies and it'd be good to have a thread to refer to.
@vblanco20-1 i could use your input on this cause you keep mentioning how you've done it in gitter but gitter is awful for archive searching.
here's what I'm thinking
entities can have a single struct Child { EntityType childId; } component.
any other entities that are children to the parent entity will get Sibling { EntityType siblingId; }
any transform changes would get a TransformActive tag added to the component.
just update the transforms at the time of the call actually maybe... no need to have a system iterate through the active transforms...
step through parent->child->sibling->sibling to update the global transforms.
though personally I still haven't found scene graph useful for anything other than for level organization so if I do implement it for bsf it's just gonna be hopefully kept simple.
i'm also thinking to not even worry about relative transforms. Just keep absolute transform component for each entity, and if wanting to edit the transform relative to the parent, just calculate the relative transform by using Inverse(childChild) * parentTransform. This may cause issues when tracking rotational changes though...
You need Parent, Child, Next Sibling, and Prev Sibling. All of the 4 at once. This could be on a SceneNode component, as i showed in the gitter. You need both siblings so you can attach and detach at O(1). With only forward sibling, detaching parent is a lot harder. Once you have that, a lot of "helper" functions can be implemented, such as IterateParents, IterateChildren, FindComponentinParent, etc
What about moving the issue here instead?
I was to write a new post about a different topic, but I could _explore_ this topic with some examples made with EnTT.
hm yea go ahead. I'll close this.
I've just realized I cannot open issues to forks. :smile:
I'm reopening this, so that I won't forget to write about it. I think I'll do it soon btw. :+1:
I'm closing this issue because the first of two posts is ready.
I've to review it to correct all the typos but I think I'll publish it during the next week. Shortly after it, I'll also publish a second post to go a bit deeper into the topic.
Both the posts use EnTT to offer some examples for real world cases. I hope you'll like it. :wink:
Most helpful comment
I'm closing this issue because the first of two posts is ready.
I've to review it to correct all the typos but I think I'll publish it during the next week. Shortly after it, I'll also publish a second post to go a bit deeper into the topic.
Both the posts use
EnTTto offer some examples for real world cases. I hope you'll like it. :wink: