aboutsummaryrefslogtreecommitdiff
path: root/src_testbed
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2021-02-22 17:40:29 +0100
committerGitHub <noreply@github.com>2021-02-22 17:40:29 +0100
commitd31a327b45118a77bd9676f350f110683a235acf (patch)
treeac972a97204f3b7d375a6c877336730312b76041 /src_testbed
parentc650bb1feff8763b309e0705fe6427ce94ed2b2e (diff)
parente5c4c2e8ffccf81aa5436c166b426a01b8b8831e (diff)
downloadrapier-d31a327b45118a77bd9676f350f110683a235acf.tar.gz
rapier-d31a327b45118a77bd9676f350f110683a235acf.tar.bz2
rapier-d31a327b45118a77bd9676f350f110683a235acf.zip
Merge pull request #119 from dimforge/joint_drive
Add joint motors
Diffstat (limited to 'src_testbed')
-rw-r--r--src_testbed/nphysics_backend.rs6
-rw-r--r--src_testbed/physx_backend.rs22
2 files changed, 25 insertions, 3 deletions
diff --git a/src_testbed/nphysics_backend.rs b/src_testbed/nphysics_backend.rs
index 8b88e28..698e255 100644
--- a/src_testbed/nphysics_backend.rs
+++ b/src_testbed/nphysics_backend.rs
@@ -121,7 +121,11 @@ impl NPhysicsWorld {
}
nphysics_joints.insert(c);
- }
+ } // JointParams::GenericJoint(_) => {
+ // eprintln!(
+ // "Joint type currently unsupported by the nphysics backend: GenericJoint."
+ // )
+ // }
}
}
diff --git a/src_testbed/physx_backend.rs b/src_testbed/physx_backend.rs
index 319736c..f2a4f8a 100644
--- a/src_testbed/physx_backend.rs
+++ b/src_testbed/physx_backend.rs
@@ -344,13 +344,27 @@ impl PhysxWorld {
.into_physx()
.into();
- physx_sys::phys_PxRevoluteJointCreate(
+ let revolute_joint = physx_sys::phys_PxRevoluteJointCreate(
physics.as_mut_ptr(),
actor1,
&frame1 as *const _,
actor2,
&frame2 as *const _,
);
+
+ physx_sys::PxRevoluteJoint_setDriveVelocity_mut(
+ revolute_joint,
+ params.motor_target_vel,
+ true,
+ );
+
+ if params.motor_damping != 0.0 {
+ physx_sys::PxRevoluteJoint_setRevoluteJointFlag_mut(
+ revolute_joint,
+ physx_sys::PxRevoluteJointFlag::eDRIVE_ENABLED,
+ true,
+ );
+ }
}
JointParams::PrismaticJoint(params) => {
@@ -420,7 +434,11 @@ impl PhysxWorld {
actor2,
&frame2 as *const _,
);
- }
+ } // JointParams::GenericJoint(_) => {
+ // eprintln!(
+ // "Joint type currently unsupported by the PhysX backend: GenericJoint."
+ // )
+ // }
}
}
}