I'm currently working on a conveyor belt simulation and I'm having some problems with that.
For collision detection I use iteration over manifold points, everything works fine with that.
Code: Select all
int numContacts = contactManifold->getNumContacts();
for (int j=0;j<numContacts;j++)
{
btManifoldPoint& pt = contactManifold->getContactPoint(j);
pt.m_lateralFrictionInitialized = true;
pt.m_lateralFrictionDir1.setValue(activeConveyor->getDirection().x(), activeConveyor->getDirection().y(), activeConveyor->getDirection().z());
pt.m_lateralFrictionDir1.normalize();
pt.m_contactMotion1 = activeConveyor->getVelocity();
pt.m_combinedFriction = 10;
}
My scene is set up like this:
A cube falls down from a slightly elevated position on another, bigger cube representing the conveyor.
Both the cube and the conveyor are created via convex hull shapes.
I can change the velocity and direction of the conveyor dynamically during simulation.
As long as I set the velocity of the conveyor before the cube impacts everything works perfectly fine. The cube collides with the conveyor, the friction is applied and the cube moves along the specified direction.
But if I set the velocity of the conveyor to zero and wait until the cube comes to a complete rest on the conveyor, then change the velocity to a different value, it doesn't work anymore. The cube just remains in its original position.
Anyone got a clue why that happens and how to avoid this behavior?
Thanks a lot for your help!
Greets
Mr.Orange