Joint API and joint motors improvements
This commit is contained in:
committed by
Sébastien Crozet
parent
e740493b98
commit
fb20d72ee2
@@ -40,17 +40,20 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
RigidBodyType::Dynamic
|
||||
};
|
||||
|
||||
let rigid_body = RigidBodyBuilder::new(status)
|
||||
.translation(vector![x + fk * shift, y, z + fi * shift])
|
||||
.build();
|
||||
let rigid_body = RigidBodyBuilder::new(status).translation(vector![
|
||||
x + fk * shift,
|
||||
y,
|
||||
z + fi * shift
|
||||
]);
|
||||
let child_handle = bodies.insert(rigid_body);
|
||||
let collider = ColliderBuilder::ball(rad).build();
|
||||
let collider = ColliderBuilder::ball(rad);
|
||||
colliders.insert_with_parent(collider, child_handle, &mut bodies);
|
||||
|
||||
// Vertical joint.
|
||||
if i > 0 {
|
||||
let parent_handle = *body_handles.last().unwrap();
|
||||
let joint = FixedJoint::new().local_anchor2(point![0.0, 0.0, -shift]);
|
||||
let joint =
|
||||
FixedJointBuilder::new().local_anchor2(point![0.0, 0.0, -shift]);
|
||||
impulse_joints.insert(parent_handle, child_handle, joint);
|
||||
}
|
||||
|
||||
@@ -58,7 +61,8 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
if k > 0 {
|
||||
let parent_index = body_handles.len() - num;
|
||||
let parent_handle = body_handles[parent_index];
|
||||
let joint = FixedJoint::new().local_anchor2(point![-shift, 0.0, 0.0]);
|
||||
let joint =
|
||||
FixedJointBuilder::new().local_anchor2(point![-shift, 0.0, 0.0]);
|
||||
impulse_joints.insert(parent_handle, child_handle, joint);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user