flaxen
flaxen copied to clipboard
Add better support for hierarchical transformations
Current support for hierarchical transformations is limited:
- Create a "parent" entity with Position, Rotation, and Scale
- For each "child", add these shared component instances.
- Then for each child, define a unique Offset relative to the parent's position
This solution does not allow children to apply their own scaling or rotation. So it's pretty sucky. It also prevents children having their own children. Which is mean.
I thought maybe the first problem could be fixed be refactoring the "View" classes as HaxePunk graphics instead of HaxePunk entities and adding a Parent component to indicate the Entity should be added as a graphic to some other entity. However a Graphic cannot specify rotation or scaling, so all this gets us is child entities can use Position relative to the parent and Offset is not necessary.
OpenFL supports hierarchical transformations built in, but that means abandoning HaxePunk which I'm not currently willing to do. So either I need to add my own hierarchical components and calculations (like OpenFL already does), or bring the conversation to HaxePunk to see if there's interest to add such capabilities to that project directly. (Perhaps allowing HaxePunk entities to accept additional entities in a GraphicList?)