Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Jondolf/bevy_xpbd
Browse files Browse the repository at this point in the history
  • Loading branch information
Jondolf committed Aug 31, 2023
2 parents 3fd2a25 + e1e7140 commit 2487cba
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/components/world_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ mod tests {

// Test if values are correct
// (reference values were calculated by hand)
assert_eq!(mass_props.mass.0, 9.7);
assert_eq!(mass_props.inverse_mass.0, 1.0 / 9.7);
assert_relative_eq!(mass_props.mass.0, 9.7);
assert_relative_eq!(mass_props.inverse_mass.0, 1.0 / 9.7);
assert_relative_eq!(
mass_props.center_of_mass.0,
Vector::X * 0.375_257 + Vector::Y * 0.835_051,
Expand Down Expand Up @@ -222,8 +222,8 @@ mod tests {
// Test if values are correct.
// The reference values were calculated by hand.
// The center of mass is computed as: (com1 * mass1 - com2 * mass2) / (mass1 - mass2).max(0.0)
assert_eq!(mass_props.mass.0, 6.5);
assert_eq!(mass_props.inverse_mass.0, 1.0 / 6.5);
assert_relative_eq!(mass_props.mass.0, 6.5);
assert_relative_eq!(mass_props.inverse_mass.0, 1.0 / 6.5);
assert_relative_eq!(
mass_props.center_of_mass.0,
Vector::NEG_X * 5.030_769 + Vector::NEG_Y * 0.246_153,
Expand Down Expand Up @@ -254,10 +254,12 @@ mod tests {
mass_props -= collider_mass_props;

// Test if values are correct. They should be equal to the original values.
// Some epsilons reduced to make test pass on apple-m1
// see: https://github.com/Jondolf/bevy_xpbd/issues/137
assert_relative_eq!(
mass_props.mass.0,
original_mass_props.mass.0,
epsilon = 0.000_001
epsilon = 0.001
);
assert_relative_eq!(
mass_props.inverse_mass.0,
Expand All @@ -267,12 +269,12 @@ mod tests {
assert_relative_eq!(
mass_props.inertia.0,
original_mass_props.inertia.0,
epsilon = 0.000_001
epsilon = 0.001
);
assert_relative_eq!(
mass_props.inverse_inertia.0,
original_mass_props.inverse_inertia.0,
epsilon = 0.000_001
epsilon = 0.001
);
assert_relative_eq!(
mass_props.center_of_mass.0,
Expand Down

0 comments on commit 2487cba

Please sign in to comment.