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

Allow customizing the schedule with FixedUpdate #385

Merged
merged 4 commits into from
Aug 6, 2023

Conversation

Aceeri
Copy link
Contributor

@Aceeri Aceeri commented Jun 19, 2023

Fixes #355

Adds common usage of plugin to adding to FixedUpdate, otherwise the simulation will run too fast in the scenario that we run based on TimestepMode::Fixed.

@Aceeri
Copy link
Contributor Author

Aceeri commented Jul 5, 2023

Should've made this a draft, shouldn't merge this until 0.11 as it isn't currently possible to use Schedules like this in 0.10.

@sebcrozet sebcrozet marked this pull request as draft July 8, 2023 08:55
@sebcrozet
Copy link
Member

sebcrozet commented Jul 8, 2023

Thank you for this PR! Based on your comment I converted it to a draft. Feel free to un-draft it once it’s ready with bevy 0.11.

Comment on lines +238 to +247
// Warn user if the timestep mode isn't in Fixed
if self.schedule.as_dyn_eq().dyn_eq(FixedUpdate.as_dyn_eq()) {
let config = app.world.resource::<RapierConfiguration>();
match config.timestep_mode {
TimestepMode::Fixed { .. } => {}
mode => {
warn!("TimestepMode is set to `{:?}`, it is recommended to use `TimestepMode::Fixed` if you have the physics in `FixedUpdate`", mode);
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we automatically set it to fixed here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m fine with the warning for now.

@Aceeri Aceeri marked this pull request as ready for review July 29, 2023 09:11
@sebcrozet
Copy link
Member

Thanks! I just renamed RapierPhysicsPlugin::fixed to ::in_fixed_schedule for better clarity.

@sebcrozet sebcrozet merged commit 3bf22ed into dimforge:master Aug 6, 2023
3 checks passed
@Aceeri Aceeri deleted the fixed-update branch August 7, 2023 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running in bevy's FixedTimestep
2 participants