6DJointDrive doesn't work

I created 6DJoint and would drive it along its X Axis. But if I change the velocity vector nothin happens.

This is the code for the joint initialization:

const physx::PxReal DENSITY_STEEL = 7850.0;
physx::PxRigidDynamic* actor1 = physics->createRigidDynamic(physx::PxTransform(0.0,3.0,0.0,physx::PxQuat(physx::PxIdentity)));

physx::PxVec3 com1(0.295, 0.0, 0.0);
physx::PxRigidBodyExt::setMassAndUpdateInertia(*(actor1), 0.00328f * DENSITY_STEEL, &(com1));

physx::PxRigidDynamic* actor2 = physics->createRigidDynamic(physx::PxTransform(0.0,3.0,0.0,physx::PxQuat(physx::PxIdentity)));

physx::PxVec3 com2(0.424, 0.0, 0.0);
physx::PxRigidBodyExt::setMassAndUpdateInertia(*(actor2), 0.00187f * DENSITY_STEEL, &(com2));

physx::PxD6Joint* joint = physx::PxD6JointCreate(
physx::PxTransform(0.0, 0.0, 0.0, physx::PxQuat(physx::PxIdentity)),
physx::PxTransform(0.0, 0.0, 0.0, physx::PxQuat(physx::PxIdentity));
joint->setMotion(physx::PxD6Axis::eX, physx::PxD6Motion::eFREE);
physx::PxD6JointDrive drive(1000000.0f, 2000000.0f, PX_MAX_F32, true);
joint->setDrive(physx::PxD6Drive::eX, drive2);
joint->setDriveVelocity(physx::PxVec3(0.0,0.0,0.0), physx::PxVec3(0.0));

later in my code I set the drive Velocity in the PreTick function with:


But the drive do not move at all. In PVD I can see that the right target velocity is set to the drive.
What did I wrong?

Thanks a lot for your answers.

No one has an idea? Please say it, too if here everything look right and I should search the problem at an other place.
If someone has an example code for creation of a pxD6Joint with linear drive and setting of its velocity while runtime please post it, too.

Thanks a lot.

Beside the problem in the posted code that when setting the drive it obviously should say drive and not drive2 the problem can be solved if the drive is declared globally (this doesn’t become fully clear by just having a look at the given code extract, the extract is part of a init method for all who wonder).

Hope this help someone beside us two.


Your code is correct and works well according to your discription (as I would expect ;). The problem you encounter is that you tell the drive to use a driveStiffness of 1000000.0f (the first argument physx::PxD6JointDrive drive). This stiffness is used to maintain/drive the position of the joint to the target position. This target position is 0.0 in your case, so no movement.

Your solution could be to put the driveStiffness to 0.0f. Mind that by doing this, your actor probably keeps on going (with some decay due to damping) after you removed the target velocity. If that is undesired I might be able to provide you some advice. But let’s see if the driveStiffness to 0.0f works.

Another point that could still spoil the working of your drive is the use of “isAcceleration=true” (last argument in physx::PxD6JointDrive drive). If your actor is connected to (very) heavy components, the acceleration setting of the drive might limit the actuation. When set to false, the drive uses the raw forces on the actor. We encounter that problem in the past.

Regards, Jeroen

Now I have created a D6JointDrive with stiffness 0 and damping 2000000.0f but if I set a velocity to the drive nothing moves. In PVD I can see that in the joint the target velocity is set.
I want that the drive reach the velocity immediatly. Is this possible? Perhaps if I set the damping rate to PX_MAX_F32?

Hello there,
I’m facing the same kind of problem, so wondering if you found a solution to you problem ?
Did you manage to get the drive moving your asset ?