Skip to content
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

Fix Time inconsistency after substepping loop #294

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Jan 5, 2024

Objective

There are currently two issues that cause Time to be inconsistent, even with a fixed timestep:

  1. After the substepping loop, the Time resource is always set to Time<Virtual>. However, the PhysicsSchedule is still running. This means that systems running after substeps but before the end of the physics schedule will have a variable Time.
  2. After the PhysicsSchedule, Time is set to Time<Virtual>. This means that if physics is run in FixedUpdate, the fixed timestep will be overwritten by Time<Virtual>.

Solution

  1. Set Time to Time<Physics> instead. The physics schedule will later set it to the default clock.
  2. Set Time to the clock that was used before the PhysicsSchedule.

@Jondolf Jondolf added bugfix A-Scheduling Relates to scheduling or system sets labels Jan 5, 2024
@Jondolf Jondolf merged commit f76ba08 into main Jan 5, 2024
4 checks passed
@Jondolf Jondolf deleted the fix-time-inconsistency branch January 5, 2024 16:36
@Jondolf Jondolf added C-Bug Something isn't working and removed bugfix labels Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Scheduling Relates to scheduling or system sets C-Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant