Implement 2d and 3d transform propagation#247
Merged
waynemwashuma merged 7 commits intoSep 10, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Introduces transform propagation for 2D and 3D entities, allowing hierarchical transformations to be automatically computed and applied. This eliminates the need for manual calculation of world transforms for child entities and simplifies the process of building complex nested transformations.
Solution
The solution leverages the existing hierarchy system (using
ParentandChildrencomponents) and introduces new systems that traverse the entity tree in a breadth-first manner. For each child entity, the global transform is computed by multiplying the parent's global transform with the child's local transform. This ensures that all children inherit their parent's position, rotation, and scale.Modified
ChildrenandParentcomponents to implementVisitEntitiesfor use in relationship queries.Showcase
To use transform propagation, simply attach
ParentandChildrencomponents to your entities. The global transform will automatically be updated to reflect the parent's transform.Example (2D):
The child will now automatically rotate and scale relative to the parent.
Migration Guide
The introduced changes bring no breaking changes, however:
GlobalTransform2DorGlobalTransform3Dto access the world-space transform of an entity.Checklist