Disable 'm_robotSim.setNumSimulationSubSteps' because it is not needed at the moment

Fix issue in contact/friction between btMultibody and btRigidBody (external force/torque of btRigidBody was not taken into account during contact/friction setup)
Allow 0.1 mm slop in contact, to avoid loosing contact. Todo: allow contacts with positive distance in multibody solver.
This commit is contained in:
erwin coumans 2016-08-27 13:44:18 -07:00
parent c741b17da8
commit 4094b9f0df
3 changed files with 8 additions and 3 deletions

View File

@ -152,7 +152,7 @@ public:
}
m_robotSim.setGravity(b3MakeVector3(0,0,-10));
m_robotSim.setNumSimulationSubSteps(4);
//m_robotSim.setNumSimulationSubSteps(4);
}

View File

@ -517,6 +517,7 @@ PhysicsServerCommandProcessor::PhysicsServerCommandProcessor()
m_data = new PhysicsServerCommandProcessorInternalData();
createEmptyDynamicsWorld();
m_data->m_dynamicsWorld->getSolverInfo().m_linearSlop = 0.0001;
}

View File

@ -408,7 +408,9 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol
{
if (rb0)
{
rel_vel += rb0->getVelocityInLocalPoint(rel_pos1).dot(solverConstraint.m_contactNormal1);
rel_vel += (rb0->getVelocityInLocalPoint(rel_pos1) +
(rb0->getTotalTorque()*rb0->getInvInertiaTensorWorld()*infoGlobal.m_timeStep).cross(rel_pos1)+
rb0->getTotalForce()*rb0->getInvMass()*infoGlobal.m_timeStep).dot(solverConstraint.m_contactNormal1);
}
}
if (multiBodyB)
@ -422,7 +424,9 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol
{
if (rb1)
{
rel_vel += rb1->getVelocityInLocalPoint(rel_pos2).dot(solverConstraint.m_contactNormal2);
rel_vel += (rb1->getVelocityInLocalPoint(rel_pos2)+
(rb1->getTotalTorque()*rb1->getInvInertiaTensorWorld()*infoGlobal.m_timeStep).cross(rel_pos2) +
rb1->getTotalForce()*rb1->getInvMass()*infoGlobal.m_timeStep).dot(solverConstraint.m_contactNormal2);
}
}