aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2021-01-04 15:14:25 +0100
committerCrozet Sébastien <developer@crozet.re>2021-01-04 15:14:25 +0100
commitaa61fe65e3ff0289ecab57b4053a3410cf6d4a87 (patch)
treea2ab513f43d779e4eb1c0edcd2a6e734b3fa4470
parenta1aa8855f76168d8af14244a54c9f28d15696342 (diff)
downloadrapier-aa61fe65e3ff0289ecab57b4053a3410cf6d4a87.tar.gz
rapier-aa61fe65e3ff0289ecab57b4053a3410cf6d4a87.tar.bz2
rapier-aa61fe65e3ff0289ecab57b4053a3410cf6d4a87.zip
Add support of 64-bits reals.
-rw-r--r--Cargo.toml27
-rw-r--r--benchmarks2d/Cargo.toml2
-rw-r--r--benchmarks3d/Cargo.toml2
-rw-r--r--build/rapier2d-f64/Cargo.toml57
-rw-r--r--build/rapier2d/Cargo.toml7
-rw-r--r--build/rapier3d-f64/Cargo.toml56
-rw-r--r--build/rapier3d/Cargo.toml7
-rw-r--r--build/rapier_testbed2d/Cargo.toml2
-rw-r--r--build/rapier_testbed3d/Cargo.toml2
-rw-r--r--examples2d/Cargo.toml2
-rw-r--r--examples3d/Cargo.toml2
-rw-r--r--src/dynamics/integration_parameters.rs56
-rw-r--r--src/dynamics/joint/ball_joint.rs16
-rw-r--r--src/dynamics/joint/fixed_joint.rs10
-rw-r--r--src/dynamics/joint/prismatic_joint.rs68
-rw-r--r--src/dynamics/joint/revolute_joint.rs24
-rw-r--r--src/dynamics/rigid_body.rs122
-rw-r--r--src/dynamics/solver/delta_vel.rs4
-rw-r--r--src/dynamics/solver/interaction_groups.rs2
-rw-r--r--src/dynamics/solver/joint_constraint/ball_position_constraint.rs32
-rw-r--r--src/dynamics/solver/joint_constraint/ball_position_constraint_wide.rs6
-rw-r--r--src/dynamics/solver/joint_constraint/ball_velocity_constraint.rs34
-rw-r--r--src/dynamics/solver/joint_constraint/ball_velocity_constraint_wide.rs10
-rw-r--r--src/dynamics/solver/joint_constraint/fixed_position_constraint.rs40
-rw-r--r--src/dynamics/solver/joint_constraint/fixed_velocity_constraint.rs54
-rw-r--r--src/dynamics/solver/joint_constraint/fixed_velocity_constraint_wide.rs12
-rw-r--r--src/dynamics/solver/joint_constraint/joint_constraint.rs5
-rw-r--r--src/dynamics/solver/joint_constraint/joint_position_constraint.rs4
-rw-r--r--src/dynamics/solver/joint_constraint/prismatic_position_constraint.rs38
-rw-r--r--src/dynamics/solver/joint_constraint/prismatic_velocity_constraint.rs74
-rw-r--r--src/dynamics/solver/joint_constraint/prismatic_velocity_constraint_wide.rs10
-rw-r--r--src/dynamics/solver/joint_constraint/revolute_position_constraint.rs34
-rw-r--r--src/dynamics/solver/joint_constraint/revolute_velocity_constraint.rs44
-rw-r--r--src/dynamics/solver/joint_constraint/revolute_velocity_constraint_wide.rs10
-rw-r--r--src/dynamics/solver/parallel_island_solver.rs10
-rw-r--r--src/dynamics/solver/parallel_position_solver.rs4
-rw-r--r--src/dynamics/solver/parallel_velocity_solver.rs2
-rw-r--r--src/dynamics/solver/position_constraint.rs26
-rw-r--r--src/dynamics/solver/position_constraint_wide.rs6
-rw-r--r--src/dynamics/solver/position_ground_constraint.rs20
-rw-r--r--src/dynamics/solver/position_ground_constraint_wide.rs6
-rw-r--r--src/dynamics/solver/position_solver.rs4
-rw-r--r--src/dynamics/solver/solver_constraints.rs7
-rw-r--r--src/dynamics/solver/velocity_constraint.rs28
-rw-r--r--src/dynamics/solver/velocity_constraint_wide.rs6
-rw-r--r--src/dynamics/solver/velocity_ground_constraint.rs20
-rw-r--r--src/dynamics/solver/velocity_ground_constraint_wide.rs6
-rw-r--r--src/dynamics/solver/velocity_solver.rs3
-rw-r--r--src/geometry/broad_phase_multi_sap.rs24
-rw-r--r--src/geometry/contact_pair.rs14
-rw-r--r--src/geometry/narrow_phase.rs4
-rw-r--r--src/lib.rs9
-rw-r--r--src/pipeline/collision_pipeline.rs3
-rw-r--r--src/pipeline/physics_pipeline.rs6
-rw-r--r--src/utils.rs93
55 files changed, 657 insertions, 519 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 0cde558..e38800b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,19 +1,24 @@
[workspace]
-members = [ "build/rapier2d", "build/rapier_testbed2d", "examples2d", "benchmarks2d",
- "build/rapier3d", "build/rapier_testbed3d", "examples3d", "benchmarks3d" ]
+members = [ "build/rapier2d", "build/rapier2d-f64", "build/rapier_testbed2d", "examples2d", "benchmarks2d",
+ "build/rapier3d", "build/rapier3d-f64", "build/rapier_testbed3d", "examples3d", "benchmarks3d" ]
[patch.crates-io]
#wrapped2d = { git = "https://github.com/Bastacyclop/rust_box2d.git" }
#simba = { path = "../simba" }
-#ncollide2d = { path = "../ncollide/build/ncollide2d" }
-#ncollide3d = { path = "../ncollide/build/ncollide3d" }
-#nphysics2d = { path = "../nphysics/build/nphysics2d" }
-#nphysics3d = { path = "../nphysics/build/nphysics3d" }
-#kiss3d = { path = "../kiss3d" }
-#cdl2d = { path = "../cdl/build/cdl2d" }
-#cdl3d = { path = "../cdl/build/cdl3d" }
-cdl2d = { git = "https://github.com/sebcrozet/cdl.git" }
-cdl3d = { git = "https://github.com/sebcrozet/cdl.git" }
+ncollide2d = { path = "../ncollide/build/ncollide2d" }
+ncollide3d = { path = "../ncollide/build/ncollide3d" }
+nphysics2d = { path = "../nphysics/build/nphysics2d" }
+nphysics3d = { path = "../nphysics/build/nphysics3d" }
+kiss3d = { path = "../kiss3d" }
+cdl2d = { path = "../cdl/build/cdl2d" }
+cdl3d = { path = "../cdl/build/cdl3d" }
+cdl2d-f64 = { path = "../cdl/build/cdl2d-f64" }
+cdl3d-f64 = { path = "../cdl/build/cdl3d-f64" }
+#cdl2d = { git = "https://github.com/sebcrozet/cdl.git" }
+#cdl3d = { git = "https://github.com/sebcrozet/cdl.git" }
+#cdl2d-f64 = { git = "https://github.com/sebcrozet/cdl.git" }
+#cdl3d-f64 = { git = "https://github.com/sebcrozet/cdl.git" }
+#nalgebra = { path = "../nalgebra" }
[profile.release]
#debug = true
diff --git a/benchmarks2d/Cargo.toml b/benchmarks2d/Cargo.toml
index 90a6326..21169bb 100644
--- a/benchmarks2d/Cargo.toml
+++ b/benchmarks2d/Cargo.toml
@@ -14,7 +14,7 @@ enhanced-determinism = [ "rapier2d/enhanced-determinism" ]
[dependencies]
rand = "0.7"
Inflector = "0.11"
-nalgebra = "0.23"
+nalgebra = "0.24"
[dependencies.rapier_testbed2d]
path = "../build/rapier_testbed2d"
diff --git a/benchmarks3d/Cargo.toml b/benchmarks3d/Cargo.toml
index 03194df..16399c9 100644
--- a/benchmarks3d/Cargo.toml
+++ b/benchmarks3d/Cargo.toml
@@ -14,7 +14,7 @@ enhanced-determinism = [ "rapier3d/enhanced-determinism" ]
[dependencies]
rand = "0.7"
Inflector = "0.11"
-nalgebra = "0.23"
+nalgebra = "0.24"
[dependencies.rapier_testbed3d]
path = "../build/rapier_testbed3d"
diff --git a/build/rapier2d-f64/Cargo.toml b/build/rapier2d-f64/Cargo.toml
new file mode 100644
index 0000000..a1a4b54
--- /dev/null
+++ b/build/rapier2d-f64/Cargo.toml
@@ -0,0 +1,57 @@
+[package]
+name = "rapier2d-f64"
+version = "0.4.2"
+authors = [ "Sébastien Crozet <developer@crozet.re>" ]
+description = "2-dimensional physics engine in Rust."
+documentation = "http://docs.rs/rapier2d"
+homepage = "http://rapier.rs"
+repository = "https://github.com/dimforge/rapier"
+readme = "README.md"
+keywords = [ "physics", "dynamics", "rigid", "real-time", "joints" ]
+license = "Apache-2.0"
+edition = "2018"
+
+[features]
+default = [ "dim2", "f64" ]
+dim2 = [ ]
+f64 = [ ]
+parallel = [ "rayon" ]
+simd-stable = [ "simba/wide", "simd-is-enabled" ]
+simd-nightly = [ "simba/packed_simd", "simd-is-enabled" ]
+# Do not enable this feature directly. It is automatically
+# enabled with the "simd-stable" or "simd-nightly" feature.
+simd-is-enabled = [ ]
+wasm-bindgen = [ "instant/wasm-bindgen" ]
+serde-serialize = [ "erased-serde", "nalgebra/serde-serialize", "cdl2d-f64/serde-serialize", "serde", "generational-arena/serde", "bit-vec/serde", "arrayvec/serde" ]
+enhanced-determinism = [ "simba/libm_force", "cdl2d-f64/enhanced-determinism", "indexmap" ]
+
+[lib]
+name = "rapier2d_f64"
+path = "../../src/lib.rs"
+required-features = [ "dim2", "f64" ]
+
+
+[dependencies]
+vec_map = "0.8"
+instant = { version = "0.1", features = [ "now" ]}
+num-traits = "0.2"
+nalgebra = "0.24"
+cdl2d-f64 = "0.1"
+simba = "0.3"
+approx = "0.4"
+rayon = { version = "1", optional = true }
+crossbeam = "0.8"
+generational-arena = "0.2"
+arrayvec = "0.5"
+bit-vec = "0.6"
+rustc-hash = "1"
+serde = { version = "1", features = [ "derive" ], optional = true }
+erased-serde = { version = "0.3", optional = true }
+indexmap = { version = "1", features = [ "serde-1" ], optional = true }
+downcast-rs = "1.2"
+num-derive = "0.3"
+bitflags = "1"
+
+[dev-dependencies]
+bincode = "1"
+serde = { version = "1", features = [ "derive" ] }
diff --git a/build/rapier2d/Cargo.toml b/build/rapier2d/Cargo.toml
index 3bbb8f0..1729e6a 100644
--- a/build/rapier2d/Cargo.toml
+++ b/build/rapier2d/Cargo.toml
@@ -12,8 +12,9 @@ license = "Apache-2.0"
edition = "2018"
[features]
-default = [ "dim2" ]
+default = [ "dim2", "f32" ]
dim2 = [ ]
+f32 = [ ]
parallel = [ "rayon" ]
simd-stable = [ "simba/wide", "simd-is-enabled" ]
simd-nightly = [ "simba/packed_simd", "simd-is-enabled" ]
@@ -27,14 +28,14 @@ enhanced-determinism = [ "simba/libm_force", "cdl2d/enhanced-determinism", "inde
[lib]
name = "rapier2d"
path = "../../src/lib.rs"
-required-features = [ "dim2" ]
+required-features = [ "dim2", "f32" ]
[dependencies]
vec_map = "0.8"
instant = { version = "0.1", features = [ "now" ]}
num-traits = "0.2"
-nalgebra = "0.23"
+nalgebra = "0.24"
cdl2d = "0.1"
simba = "0.3"
approx = "0.4"
diff --git a/build/rapier3d-f64/Cargo.toml b/build/rapier3d-f64/Cargo.toml
new file mode 100644
index 0000000..6c46557
--- /dev/null
+++ b/build/rapier3d-f64/Cargo.toml
@@ -0,0 +1,56 @@
+[package]
+name = "rapier3d-f64"
+version = "0.4.2"
+authors = [ "Sébastien Crozet <developer@crozet.re>" ]
+description = "3-dimensional physics engine in Rust."
+documentation = "http://docs.rs/rapier3d"
+homepage = "http://rapier.rs"
+repository = "https://github.com/dimforge/rapier"
+readme = "README.md"
+keywords = [ "physics", "dynamics", "rigid", "real-time", "joints" ]
+license = "Apache-2.0"
+edition = "2018"
+
+[features]
+default = [ "dim3", "f64" ]
+dim3 = [ ]
+f64 = [ ]
+parallel = [ "rayon" ]
+simd-stable = [ "cdl3d-f64/simd-stable", "simba/wide", "simd-is-enabled" ]
+simd-nightly = [ "cdl3d-f64/simd-nightly", "simba/packed_simd", "simd-is-enabled" ]
+# Do not enable this feature directly. It is automatically
+# enabled with the "simd-stable" or "simd-nightly" feature.
+simd-is-enabled = [ ]
+wasm-bindgen = [ "instant/wasm-bindgen" ]
+serde-serialize = [ "erased-serde", "nalgebra/serde-serialize", "cdl3d-f64/serde-serialize", "serde", "generational-arena/serde", "bit-vec/serde" ]
+enhanced-determinism = [ "simba/libm_force", "cdl3d-f64/enhanced-determinism" ]
+
+[lib]
+name = "rapier3d_f64"
+path = "../../src/lib.rs"
+required-features = [ "dim3", "f64" ]
+
+
+[dependencies]
+vec_map = "0.8"
+instant = { version = "0.1", features = [ "now" ]}
+num-traits = "0.2"
+nalgebra = "0.24"
+cdl3d-f64 = "0.1"
+simba = "0.3"
+approx = "0.4"
+rayon = { version = "1", optional = true }
+crossbeam = "0.8"
+generational-arena = "0.2"
+arrayvec = "0.5"
+bit-vec = "0.6"
+rustc-hash = "1"
+serde = { version = "1", features = [ "derive" ], optional = true }
+erased-serde = { version = "0.3", optional = true }
+downcast-rs = "1.2"
+num-derive = "0.3"
+bitflags = "1"
+
+[dev-dependencies]
+bincode = "1"
+serde = { version = "1", features = [ "derive" ] }
diff --git a/build/rapier3d/Cargo.toml b/build/rapier3d/Cargo.toml
index d2a1fae..6c8e4d1 100644
--- a/build/rapier3d/Cargo.toml
+++ b/build/rapier3d/Cargo.toml
@@ -12,8 +12,9 @@ license = "Apache-2.0"
edition = "2018"
[features]
-default = [ "dim3" ]
+default = [ "dim3", "f32" ]
dim3 = [ ]
+f32 = [ ]
parallel = [ "rayon" ]
simd-stable = [ "cdl3d/simd-stable", "simba/wide", "simd-is-enabled" ]
simd-nightly = [ "cdl3d/simd-nightly", "simba/packed_simd", "simd-is-enabled" ]
@@ -27,14 +28,14 @@ enhanced-determinism = [ "simba/libm_force", "cdl3d/enhanced-determinism" ]
[lib]
name = "rapier3d"
path = "../../src/lib.rs"
-required-features = [ "dim3" ]
+required-features = [ "dim3", "f32" ]
[dependencies]
vec_map = "0.8"
instant = { version = "0.1", features = [ "now" ]}
num-traits = "0.2"
-nalgebra = "0.23"
+nalgebra = "0.24"
cdl3d = "0.1"
simba = "0.3"
approx = "0.4"
diff --git a/build/rapier_testbed2d/Cargo.toml b/build/rapier_testbed2d/Cargo.toml
index 63d1136..c1ac651 100644
--- a/build/rapier_testbed2d/Cargo.toml
+++ b/build/rapier_testbed2d/Cargo.toml
@@ -23,7 +23,7 @@ other-backends = [ "wrapped2d", "nphysics2d" ]
[dependencies]
-nalgebra = "0.23"
+nalgebra = "0.24"
kiss3d = { version = "0.28", features = [ "conrod" ] }
rand = "0.7"
rand_pcg = "0.2"
diff --git a/build/rapier_testbed3d/Cargo.toml b/build/rapier_testbed3d/Cargo.toml
index f307211..af2311c 100644
--- a/build/rapier_testbed3d/Cargo.toml
+++ b/build/rapier_testbed3d/Cargo.toml
@@ -22,7 +22,7 @@ parallel = [ "rapier3d/parallel", "num_cpus" ]
other-backends = [ "physx", "physx-sys", "glam", "nphysics3d" ]
[dependencies]
-nalgebra = "0.23"
+nalgebra = "0.24"
kiss3d = { version = "0.28", features = [ "conrod" ] }
rand = "0.7"
rand_pcg = "0.2"
diff --git a/examples2d/Cargo.toml b/examples2d/Cargo.toml
index f1ed728..6580923 100644
--- a/examples2d/Cargo.toml
+++ b/examples2d/Cargo.toml
@@ -14,7 +14,7 @@ enhanced-determinism = [ "rapier2d/enhanced-determinism" ]
[dependencies]
rand = "0.7"
Inflector = "0.11"
-nalgebra = "0.23"
+nalgebra = "0.24"
[dependencies.rapier_testbed2d]
path = "../build/rapier_testbed2d"
diff --git a/examples3d/Cargo.toml b/examples3d/Cargo.toml
index 46fbca6..1f9cba3 100644
--- a/examples3d/Cargo.toml
+++ b/examples3d/Cargo.toml
@@ -14,7 +14,7 @@ enhanced-determinism = [ "rapier3d/enhanced-determinism" ]
[dependencies]
rand = "0.7"
Inflector = "0.11"
-nalgebra = "0.23"
+nalgebra = "0.24"
[dependencies.rapier_testbed3d]
path = "../build/rapier_testbed3d"
diff --git a/src/dynamics/integration_parameters.rs b/src/dynamics/integration_parameters.rs
index b31c3f6..706fb3f 100644
--- a/src/dynamics/integration_parameters.rs
+++ b/src/dynamics/integration_parameters.rs
@@ -1,11 +1,13 @@
+use crate::math::Real;
+
/// Parameters for a time-step of the physics engine.
#[derive(Clone)]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
pub struct IntegrationParameters {
/// The timestep length (default: `1.0 / 60.0`)
- dt: f32,
+ dt: Real,
/// The inverse of `dt`.
- inv_dt: f32,
+ inv_dt: Real,
// /// If `true` and if rapier is compiled with the `parallel` feature, this will enable rayon-based multithreading (default: `true`).
// ///
// /// This parameter is ignored if rapier is not compiled with is `parallel` feature.
@@ -19,31 +21,31 @@ pub struct IntegrationParameters {
pub return_after_ccd_substep: bool,
/// The Error Reduction Parameter in `[0, 1]` is the proportion of
/// the positional error to be corrected at each time step (default: `0.2`).
- pub erp: f32,
+ pub erp: Real,
/// The Error Reduction Parameter for joints in `[0, 1]` is the proportion of
/// the positional error to be corrected at each time step (default: `0.2`).
- pub joint_erp: f32,
+ pub joint_erp: Real,
/// Each cached impulse are multiplied by this coefficient in `[0, 1]`
/// when they are re-used to initialize the solver (default `1.0`).
- pub warmstart_coeff: f32,
+ pub warmstart_coeff: Real,
/// Contacts at points where the involved bodies have a relative
/// velocity smaller than this threshold wont be affected by the restitution force (default: `1.0`).
- pub restitution_velocity_threshold: f32,
+ pub restitution_velocity_threshold: Real,
/// Amount of penetration the engine wont attempt to correct (default: `0.001m`).
- pub allowed_linear_error: f32,
+ pub allowed_linear_error: Real,
/// The maximal distance separating two objects that will generate predictive contacts (default: `0.002`).
- pub prediction_distance: f32,
+ pub prediction_distance: Real,
/// Amount of angular drift of joint limits the engine wont
/// attempt to correct (default: `0.001rad`).
- pub allowed_angular_error: f32,
+ pub allowed_angular_error: Real,
/// Maximum linear correction during one step of the non-linear position solver (default: `0.2`).
- pub max_linear_correction: f32,
+ pub max_linear_correction: Real,
/// Maximum angular correction during one step of the non-linear position solver (default: `0.2`).
- pub max_angular_correction: f32,
+ pub max_angular_correction: Real,
/// Maximum nonlinear SOR-prox scaling parameter when the constraint
/// correction direction is close to the kernel of the involved multibody's
/// jacobian (default: `0.2`).
- pub max_stabilization_multiplier: f32,
+ pub max_stabilization_multiplier: Real,
/// Maximum number of iterations performed by the velocity constraints solver (default: `4`).
pub max_velocity_iterations: usize,
/// Maximum number of iterations performed by the position-based constraints solver (default: `1`).
@@ -88,18 +90,18 @@ pub struct IntegrationParameters {
impl IntegrationParameters {
/// Creates a set of integration parameters with the given values.
pub fn new(
- dt: f32,
+ dt: Real,
// multithreading_enabled: bool,
- erp: f32,
- joint_erp: f32,
- warmstart_coeff: f32,
- restitution_velocity_threshold: f32,
- allowed_linear_error: f32,
- allowed_angular_error: f32,
- max_linear_correction: f32,
- max_angular_correction: f32,
- prediction_distance: f32,
- max_stabilization_multiplier: f32,
+ erp: Real,
+ joint_erp: Real,
+ warmstart_coeff: Real,
+ restitution_velocity_threshold: Real,
+ allowed_linear_error: Real,
+ allowed_angular_error: Real,
+ max_linear_correction: Real,
+ max_angular_correction: Real,
+ prediction_distance: Real,
+ max_stabilization_multiplier: Real,
max_velocity_iterations: usize,
max_position_iterations: usize,
max_ccd_position_iterations: usize,
@@ -140,7 +142,7 @@ impl IntegrationParameters {
/// The current time-stepping length.
#[inline(always)]
- pub fn dt(&self) -> f32 {
+ pub fn dt(&self) -> Real {
self.dt
}
@@ -148,7 +150,7 @@ impl IntegrationParameters {
///
/// This is zero if `self.dt` is zero.
#[inline(always)]
- pub fn inv_dt(&self) -> f32 {
+ pub fn inv_dt(&self) -> Real {
self.inv_dt
}
@@ -156,7 +158,7 @@ impl IntegrationParameters {
///
/// This automatically recompute `self.inv_dt`.
#[inline]
- pub fn set_dt(&mut self, dt: f32) {
+ pub fn set_dt(&mut self, dt: Real) {
assert!(dt >= 0.0, "The time-stepping length cannot be negative.");
self.dt = dt;
if dt == 0.0 {
@@ -170,7 +172,7 @@ impl IntegrationParameters {
///
/// This automatically recompute `self.dt`.
#[inline]
- pub fn set_inv_dt(&mut self, inv_dt: f32) {
+ pub fn set_inv_dt(&mut self, inv_dt: Real) {
self.inv_dt = inv_dt;
if inv_dt == 0.0 {
self.dt = 0.0
diff --git a/src/dynamics/joint/ball_joint.rs b/src/dynamics/joint/ball_joint.rs
index ec255d4..82e2a10 100644
--- a/src/dynamics/joint/ball_joint.rs
+++ b/src/dynamics/joint/ball_joint.rs
@@ -1,29 +1,29 @@
-use crate::math::{Point, Vector};
+use crate::math::{Point, Real, Vector};
#[derive(Copy, Clone)]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
/// A joint that removes all relative linear motion between a pair of points on two bodies.
pub struct BallJoint {
/// Where the ball joint is attached on the first body, expressed in the first body local frame.
- pub local_anchor1: Point<f32>,
+ pub local_anchor1: Point<Real>,
/// Where the ball joint is attached on the first body, expressed in the first body local frame.
- pub local_anchor2: Point<f32>,
+ pub local_anchor2: Point<Real>,
/// The impulse applied by this joint on the first body.
///
/// The impulse applied to the second body is given by `-impulse`.
- pub impulse: Vector<f32>,
+ pub impulse: Vector<Real>,
}
impl BallJoint {
/// Creates a new Ball joint from two anchors given on the local spaces of the respective bodies.
- pub fn new(local_anchor1: Point<f32>, local_anchor2: Point<f32>) -> Self {
+ pub fn new(local_anchor1: Point<Real>, local_anchor2: Point<Real>) -> Self {
Self::with_impulse(local_anchor1, local_anchor2, Vector::zeros())
}
pub(crate) fn with_impulse(
- local_anchor1: Point<f32>,
- local_anchor2: Point<f32>,
- impulse: Vector<f32>,
+ local_anchor1: Point<Real>,
+ local_anchor2: Point<Real>,
+ impulse: Vector<Real>,
) -> Self {
Self {
local_anchor1,
diff --git a/src/dynamics/joint/fixed_joint.rs b/src/dynamics/joint/fixed_joint.rs
index 0731cfb..359e14a 100644
--- a/src/dynamics/joint/fixed_joint.rs
+++ b/src/dynamics/joint/fixed_joint.rs
@@ -1,4 +1,4 @@
-use crate::math::{Isometry, SpacialVector};
+use crate::math::{Isometry, Real, SpacialVector};
#[derive(Copy, Clone)]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
@@ -8,22 +8,22 @@ use crate::math::{Isometry, SpacialVector};
pub struct FixedJoint {
/// The frame of reference for the first body affected by this joint, expressed in the local frame
/// of the first body.
- pub local_anchor1: Isometry<f32>,
+ pub local_anchor1: Isometry<Real>,
/// The frame of reference for the second body affected by this joint, expressed in the local frame
/// of the first body.
- pub local_anchor2: Isometry<f32>,
+ pub local_anchor2: Isometry<Real>,
/// The impulse applied to the first body affected by this joint.
///
/// The impulse applied to the second body affected by this joint is given by `-impulse`.
/// This combines both linear and angular impulses:
/// - In 2D, `impulse.xy()` gives the linear impulse, and `impulse.z` the angular impulse.
/// - In 3D, `impulse.xyz()` gives the linear impulse, and `(impulse[3], impulse[4], impulse[5])` the angular impulse.
- pub impulse: SpacialVector<f32>,
+ pub impulse: SpacialVector<Real>,
}
impl FixedJoint {
/// Creates a new fixed joint from the frames of reference of both bodies.
- pub fn new(local_anchor1: Isometry<f32>, local_anchor2: Isometry<f32>) -> Self {
+ pub fn new(local_anchor1: Isometry<Real>, local_anchor2: Isometry<Real>) -> Self {
Self {
local_anchor1,
local_anchor2,
diff --git a/src/dynamics/joint/prismatic_joint.rs b/src/dynamics/joint/prismatic_joint.rs
index a6fd558..174ce79 100644
--- a/src/dynamics/joint/prismatic_joint.rs
+++ b/src/dynamics/joint/prismatic_joint.rs
@@ -1,4 +1,4 @@
-use crate::math::{Isometry, Point, Vector, DIM};
+use crate::math::{Isometry, Point, Real, Vector, DIM};
use crate::utils::WBasis;
use na::Unit;
#[cfg(feature = "dim2")]
@@ -11,35 +11,35 @@ use na::Vector5;
/// A joint that removes all relative motion between two bodies, except for the translations along one axis.
pub struct PrismaticJoint {
/// Where the prismatic joint is attached on the first body, expressed in the local space of the first attached body.
- pub local_anchor1: Point<f32>,
+ pub local_anchor1: Point<Real>