aboutsummaryrefslogtreecommitdiff
path: root/examples3d/debug_prismatic3.rs
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2022-01-02 18:05:50 +0100
committerGitHub <noreply@github.com>2022-01-02 18:05:50 +0100
commit1308db89948bc62fb865b32f832f19268f23dd23 (patch)
treeb3d8b0cbb6d2e75aa8fc7686e9cb8801527a31b8 /examples3d/debug_prismatic3.rs
parent8e7da5ad45d180b0d3fa2bde37f8f3771b153b70 (diff)
parent9f9d3293605fa84555c08bec5efe68a71cd18432 (diff)
downloadrapier-1308db89948bc62fb865b32f832f19268f23dd23.tar.gz
rapier-1308db89948bc62fb865b32f832f19268f23dd23.tar.bz2
rapier-1308db89948bc62fb865b32f832f19268f23dd23.zip
Merge pull request #267 from dimforge/multibody
Implement multibody joints, and new velocity-based constraints solver
Diffstat (limited to 'examples3d/debug_prismatic3.rs')
-rw-r--r--examples3d/debug_prismatic3.rs24
1 files changed, 9 insertions, 15 deletions
diff --git a/examples3d/debug_prismatic3.rs b/examples3d/debug_prismatic3.rs
index 43c6cc0..15176f3 100644
--- a/examples3d/debug_prismatic3.rs
+++ b/examples3d/debug_prismatic3.rs
@@ -4,7 +4,7 @@ use rapier_testbed3d::Testbed;
fn prismatic_repro(
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
- joints: &mut JointSet,
+ impulse_joints: &mut ImpulseJointSet,
box_center: Point<f32>,
) {
let box_rb = bodies.insert(
@@ -39,19 +39,12 @@ fn prismatic_repro(
);
colliders.insert_with_parent(ColliderBuilder::ball(0.5).build(), wheel_rb, bodies);
- let mut prismatic = rapier3d::dynamics::PrismaticJoint::new(
- point![pos.x, pos.y, pos.z],
- Vector::y_axis(),
- Vector::zeros(),
- Point::origin(),
- Vector::y_axis(),
- Vector::default(),
- );
- prismatic.configure_motor_model(rapier3d::dynamics::SpringModel::VelocityBased);
let (stiffness, damping) = (0.05, 0.2);
- prismatic.configure_motor_position(0.0, stiffness, damping);
- joints.insert(box_rb, wheel_rb, prismatic);
+ let prismatic = PrismaticJoint::new(Vector::y_axis())
+ .local_anchor1(point![pos.x, pos.y, pos.z])
+ .motor_position(0.0, stiffness, damping);
+ impulse_joints.insert(box_rb, wheel_rb, prismatic);
}
// put a small box under one of the wheels
@@ -73,7 +66,8 @@ pub fn init_world(testbed: &mut Testbed) {
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
- let mut joints = JointSet::new();
+ let mut impulse_joints = ImpulseJointSet::new();
+ let multibody_joints = MultibodyJointSet::new();
/*
* Ground
@@ -91,13 +85,13 @@ pub fn init_world(testbed: &mut Testbed) {
prismatic_repro(
&mut bodies,
&mut colliders,
- &mut joints,
+ &mut impulse_joints,
point![0.0, 5.0, 0.0],
);
/*
* Set up the testbed.
*/
- testbed.set_world(bodies, colliders, joints);
+ testbed.set_world(bodies, colliders, impulse_joints, multibody_joints);
testbed.look_at(point![10.0, 10.0, 10.0], Point::origin());
}