-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Propagate transforms in fixed update #7929
base: main
Are you sure you want to change the base?
Conversation
We will need to add base sets to the |
Marking this as blocked on #7835 then. |
won't this potentially run propagate_transforms multiple times in a frame even if a user isn't using fixed update? Or is the cost of that negligible with the change checking? |
1d1774f
to
91ce046
Compare
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.
It would be really nice if there was a way for multiple systems/instances of a system to share the same last_run
change tick. That would allow us to avoid duplicate propagations across schedules.
// A set for `propagate_transforms` to mark it as ambiguous with `sync_simple_transforms`. | ||
// Used instead of the `SystemTypeSet` as that would not allow multiple instances of the system. | ||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)] | ||
struct PropagateTransformsSet; |
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.
This should probably be a local type inside of fn propagate_in_schedule
.
fn propagate_in_schedule(schedule: &mut Schedule) { | ||
// FIXME: https://github.com/bevyengine/bevy/issues/4381 | ||
// These systems cannot access the same entities, | ||
// due to subtle query filtering that is not yet correctly computed in the ambiguity detector | ||
schedule | ||
.add_system( | ||
sync_simple_transforms | ||
.in_set(TransformSystem::TransformPropagate) | ||
.ambiguous_with(PropagateTransformsSet), | ||
) | ||
.add_system(propagate_transforms.in_set(PropagateTransformsSet)); | ||
} |
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.
Instead of adding systems to an &mut Schedule
, can you make this return a SystemConfigs
struct? Then the caller would just call add_systems
with the result to add both systems to a schedule.
Objective
Fix #7836.
GlobalTransform
is not updated inFixedUpdate
.Solution
Add it to
FixedUpdate
, keep the same system sets, clean up the code a bit.Changelog
Changed: Transform propagation now runs in
CoreSet::FixedUpdate
.