aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnonymousAcid <anonymousacid14@gmail.com>2023-12-26 22:47:33 -0800
committerSébastien Crozet <sebcrozet@dimforge.com>2024-01-24 22:59:14 +0100
commit2ed34bacf4c32cea5fa419a604b685822392c77a (patch)
treec1d66bccd2adc4d6a5a03bf089e567bab24e4451
parentb96e61853bf3c541f26f2dcef33379dae5d932b4 (diff)
downloadrapier-2ed34bacf4c32cea5fa419a604b685822392c77a.tar.gz
rapier-2ed34bacf4c32cea5fa419a604b685822392c77a.tar.bz2
rapier-2ed34bacf4c32cea5fa419a604b685822392c77a.zip
Fix dimforge#416 - update ball joint motor pos
-rw-r--r--examples3d/spherical_joint_testing.rs4
-rw-r--r--src/dynamics/joint/multibody_joint/multibody_joint.rs3
2 files changed, 5 insertions, 2 deletions
diff --git a/examples3d/spherical_joint_testing.rs b/examples3d/spherical_joint_testing.rs
index e5f6ace..7a601f9 100644
--- a/examples3d/spherical_joint_testing.rs
+++ b/examples3d/spherical_joint_testing.rs
@@ -1,11 +1,11 @@
use rapier3d::prelude::*;
-use rapier_testbed3d::{Testbed, TestbedApp};
+use rapier_testbed3d::Testbed;
pub fn init_world(testbed: &mut Testbed) {
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
- let impulse_joints = ImpulseJointSet::new();
+ let mut impulse_joints = ImpulseJointSet::new();
let mut multibody_joints = MultibodyJointSet::new();
diff --git a/src/dynamics/joint/multibody_joint/multibody_joint.rs b/src/dynamics/joint/multibody_joint/multibody_joint.rs
index 62fc434..11ea890 100644
--- a/src/dynamics/joint/multibody_joint/multibody_joint.rs
+++ b/src/dynamics/joint/multibody_joint/multibody_joint.rs
@@ -115,6 +115,9 @@ impl MultibodyJoint {
let angvel = Vector3::from_row_slice(&vels[curr_free_dof..curr_free_dof + 3]);
let disp = UnitQuaternion::new_eps(angvel * dt, 0.0);
self.joint_rot = disp * self.joint_rot;
+ self.coords[3] += angvel[0] * dt;
+ self.coords[4] += angvel[1] * dt;
+ self.coords[5] += angvel[2] * dt;
}
_ => unreachable!(),
}