-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only propagate transforms entities with GlobalTransforms. #14384
Only propagate transforms entities with GlobalTransforms. #14384
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the correct behavior. We shouldn't waste serious amounts of time in real applications trying to propagate transforms that don't exist.
Just to be clear in a scenario where you have this tree: |
Approved, but I want to point out that this might be a surprising change for people who use organizational entities in their tree with only names, e.g.
This code would now suddenly break in a subtle way. Maybe a migration guide or some documentation would be good. |
I wrote up a nice little migration guide, and added a bit more context to the PR description :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I think that it's showing something very wrong is happening.
This should at minimum be a warning, at best be rejected |
What is |
I assume they don't have holes but just big hierarchies without any transforms, which should be supported. I think the note about holes no longer being supported is just pointing out the logical consequences of this PR. I would be careful with adding checks for warnings to transform propagation as it's quite a hot path. If they're added, I'd like to see a benchmark. |
Bevy already has validation for components that should exist uninterrupted all the way up the tree, but they run in a separate system. There is no reason validation logic has to live inside the propagation code. |
Objective
Fixes a performance issue when you have 1000s of entities in a bevy hierarchy without transforms.
This was prominently happening in
bevy_ecs_tilemap
.Solution
Filter out entities that don't have a global transform.
Testing
CI
We should test some other way...
Migration Guide
Transform
/GlobalTransform
propagation is no longer performed down through hierarchies where intermediate parent are missing aGlobalTransform
. To restore the previous behavior, addGlobalTransform::default
to intermediate entities.