aboutsummaryrefslogtreecommitdiff
path: root/examples3d/heightfield3.rs
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2020-11-23 15:52:22 +0100
committerGitHub <noreply@github.com>2020-11-23 15:52:22 +0100
commitc641114f016c47f6b22acc084610847f88ff5a66 (patch)
treed171cf0a72927b76ee20fda8f215477b4a5cd987 /examples3d/heightfield3.rs
parent4219bedb8b09a31a7ee8a9cd687db493215174a3 (diff)
parentc7ed2c99c12747ce8dc765e0ac0f40967bc8bacd (diff)
downloadrapier-c641114f016c47f6b22acc084610847f88ff5a66.tar.gz
rapier-c641114f016c47f6b22acc084610847f88ff5a66.tar.bz2
rapier-c641114f016c47f6b22acc084610847f88ff5a66.zip
Merge pull request #67 from dimforge/determinism_apple_m1
Fix cross-platform determinism on the Apple M1 processor
Diffstat (limited to 'examples3d/heightfield3.rs')
-rw-r--r--examples3d/heightfield3.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/examples3d/heightfield3.rs b/examples3d/heightfield3.rs
index 6af93c7..59380d5 100644
--- a/examples3d/heightfield3.rs
+++ b/examples3d/heightfield3.rs
@@ -1,4 +1,4 @@
-use na::{DMatrix, Point3, Vector3};
+use na::{ComplexField, DMatrix, Point3, Vector3};
use rapier3d::dynamics::{JointSet, RigidBodyBuilder, RigidBodySet};
use rapier3d::geometry::{ColliderBuilder, ColliderSet};
use rapier_testbed3d::Testbed;
@@ -23,7 +23,11 @@ pub fn init_world(testbed: &mut Testbed) {
} else {
let x = i as f32 * ground_size.x / (nsubdivs as f32);
let z = j as f32 * ground_size.z / (nsubdivs as f32);
- x.sin() + z.cos()
+
+ // NOTE: make sure we use the sin/cos from simba to ensure
+ // cross-platform determinism of the example when the
+ // enhanced_determinism feature is enabled.
+ (<f32 as ComplexField>::sin(x) + <f32 as ComplexField>::cos(z))
}
});