Skip to content

Commit

Permalink
Fix regression with rotation ignoring center of mass
Browse files Browse the repository at this point in the history
  • Loading branch information
Jondolf committed Jul 1, 2024
1 parent dac60da commit 01569aa
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/dynamics/solver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,20 @@ impl Plugin for SolverPlugin {
.in_set(PhysicsStepSet::Solver),
);

// Update previous rotations before the substepping loop.
physics.add_systems(
(|mut query: Query<(&Rotation, &mut PreviousRotation)>| {
for (rot, mut prev_rot) in &mut query {
prev_rot.0 = *rot;
}
})
.in_set(SolverSet::PreSubstep),
);

// Finalize the positions of bodies by applying the `AccumulatedTranslation`.
// This runs after the substepping loop.
physics.add_systems(
(
(|mut query: Query<(&Rotation, &mut PreviousRotation)>| {
for (rot, mut prev_rot) in &mut query {
prev_rot.0 = *rot;
}
}),
apply_translation,
)
apply_translation
.chain()
.in_set(SolverSet::ApplyTranslation),
);
Expand Down

0 comments on commit 01569aa

Please sign in to comment.