aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics/joint
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2021-02-21 17:14:34 +0100
committerCrozet Sébastien <developer@crozet.re>2021-02-21 17:14:43 +0100
commitf5515c39736aced54f65879a42b2a74a68609ee7 (patch)
treebca6045915179a7a7e4e95f8ef5b769ca7ecb439 /src/dynamics/joint
parentdc8ccc0c30e75aea8f144dbfad16be088d4d4ea2 (diff)
downloadrapier-f5515c39736aced54f65879a42b2a74a68609ee7.tar.gz
rapier-f5515c39736aced54f65879a42b2a74a68609ee7.tar.bz2
rapier-f5515c39736aced54f65879a42b2a74a68609ee7.zip
Fix lever-arm handling in the revolute joint.
Diffstat (limited to 'src/dynamics/joint')
-rw-r--r--src/dynamics/joint/revolute_joint.rs2
-rw-r--r--src/dynamics/joint/spring_model.rs6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/dynamics/joint/revolute_joint.rs b/src/dynamics/joint/revolute_joint.rs
index 022779d..e1e1441 100644
--- a/src/dynamics/joint/revolute_joint.rs
+++ b/src/dynamics/joint/revolute_joint.rs
@@ -72,7 +72,7 @@ impl RevoluteJoint {
motor_max_impulse: Real::MAX,
motor_impulse: 0.0,
prev_axis1: *local_axis1,
- motor_model: SpringModel::VelocityBased,
+ motor_model: SpringModel::default(),
motor_last_angle: 0.0,
}
}
diff --git a/src/dynamics/joint/spring_model.rs b/src/dynamics/joint/spring_model.rs
index dd6035d..c2c9ebd 100644
--- a/src/dynamics/joint/spring_model.rs
+++ b/src/dynamics/joint/spring_model.rs
@@ -21,6 +21,12 @@ pub enum SpringModel {
ForceBased,
}
+impl Default for SpringModel {
+ fn default() -> Self {
+ SpringModel::VelocityBased
+ }
+}
+
impl SpringModel {
/// Combines the coefficients used for solving the spring equation.
///