Contact Modify Target Velocity


I would like to use PxContactSet::setTargetVelocity to achieve conveyor belt-like effects.
The box in my simulation is moving on the conveyor until it hits an obstacle (diverter) - I don’t know how to change to parameters to achieve realistic simulation results.
When I use initial velocity instead (for examlple gBox->setLinearVelocity(PxVec3(2.0f, 0.0f, 0.0f)) everything works fine but it is also not realistic…

Does anybody know how target velocity could work correctly or does anybody has experience withconveyor belt-like effects?

“The user-defined target velocity is used to complement the normal and frictional response to a contact. The actual response to a contact depends on the relative velocity, bounce threshold, mass properties and material properties.”


If I take a sphere instead of a box the sphere does not start moving on the conveyor - here it is only one contact point --> solved: sceneDesc.frictionType = PxFrictionType::eTWO_DIRECTIONAL ist working - eONE_DIRECTIONAL is not working
–> next question (see attached jpg file): why does the sphere stop at the obstacle (realistic result would be, if the sphere continues rotation)
Does anybody know how to chose parameters correctly?

Next Test: I have a conveyor target velocity in x-direction and a obstacle target velocity in y-direction. Everything works fine, until the sphere touches the obstacle - the sphere stops moving and turning… What is wrong?

void ContactModifyCallback::onContactModify(PxContactModifyPair *const pairs, PxU32 count)
for(PxU32 i = 0; i < count; i++)
// Conveyor Belt 1
if(pairs[i].actor[0] == gConveyor || pairs[i].actor[1] == gConveyor)
setTargetVelocity(pairs[i], PxVec3(1.0f, 0.0f, 0.0f));
// Obstacle1
if(pairs[i].actor[0] == gObstacle || pairs[i].actor[1] == gObstacle)
setTargetVelocity(pairs[i], PxVec3(0.0f, 1.0f, 0.0f));

static void setTargetVelocity(PxContactModifyPair& pair, const PxVec3& targetVelocity)
for(PxU32 i = 0; i < pair.contacts.size(); ++i)

	pair.contacts.setTargetVelocity(i, targetVelocity);


If I change the obstacle to a heavy RigidDynamic object and only set targetvelocity between sphere and conveyor, the sphere stops at the obstacle but conitnue its rotation!! Why it doesn’t work with two rigid static + one rigid dynamic?

Nobody here with more detailed understanding in applying target velocity in contact modification?

In general it should work, but it’s hard to guess what is going wrong here.

There must be a bug in the collision solver:

When a PxRigidDynamic collides with a PxRigidStatic, the target velocity works fine. When a PxRigidDynamic collides with an other PxRigidDynamic and a PxRigidStatic, the target velocity works fine. When a PxRigidDynamic collides with two PxRigidStatic (for example floor and obstacle) the target velocity doesn’t work.

Are you using CCD (continuous collision detection)? If so, disable it and test it again.

This is a bug in the constraint solver, which should be fixed in PhysX 3.3.3. A short-term workaround if an upgrade to PhysX 3.3.3 is not possible would be to use a kinematic rigid body as your colliders, e.g. a PxRigidDynamic with eKINEMATIC flag raised.