From 5b80c4efbf93ad1294c9d3d390d8c8f090681b0e Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Wed, 10 Feb 2021 11:56:51 +0100 Subject: Start experimenting with a generic joint implementation for joint drives. --- src_testbed/physx_backend.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src_testbed/physx_backend.rs') diff --git a/src_testbed/physx_backend.rs b/src_testbed/physx_backend.rs index 319736c..011a450 100644 --- a/src_testbed/physx_backend.rs +++ b/src_testbed/physx_backend.rs @@ -421,6 +421,11 @@ impl PhysxWorld { &frame2 as *const _, ); } + JointParams::GenericJoint(_) => { + eprintln!( + "Joint type currently unsupported by the nphysics backend: GenericJoint." + ) + } } } } -- cgit From e9f17f32e8dda4b97d2eb7b2118b7373d0c554d0 Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Fri, 19 Feb 2021 15:21:25 +0100 Subject: Complete the implementation of non-simd joint motor for the revolute joint. --- src_testbed/physx_backend.rs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src_testbed/physx_backend.rs') diff --git a/src_testbed/physx_backend.rs b/src_testbed/physx_backend.rs index 011a450..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,12 +434,11 @@ impl PhysxWorld { actor2, &frame2 as *const _, ); - } - JointParams::GenericJoint(_) => { - eprintln!( - "Joint type currently unsupported by the nphysics backend: GenericJoint." - ) - } + } // JointParams::GenericJoint(_) => { + // eprintln!( + // "Joint type currently unsupported by the PhysX backend: GenericJoint." + // ) + // } } } } -- cgit