Hi Erwin, thanks for taking your time to reply.
Now - I am also not sure I understood you well.
What I meant was the fact that joints/non-contact relative velocity is determined this way (
btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(.)):
Code: Select all
btScalar vel1Dotn = solverConstraint.m_contactNormal.dot(rbA.getLinearVelocity()) + solverConstraint.m_relpos1CrossNormal.dot(rbA.getAngularVelocity());
btScalar vel2Dotn = -solverConstraint.m_contactNormal.dot(rbB.getLinearVelocity()) + solverConstraint.m_relpos2CrossNormal.dot(rbB.getAngularVelocity());
rel_vel = vel1Dotn+vel2Dotn;
i.e. velocity stored in
btRigidBody objects is used which is the corrected velocity from the previous step, since as far as I could see,
btRigidBody object velocities don't get updated until the solver is done.
Relative velocity for contacts is determined differently (
btSequentialImpulseConstraintSolver::setupContactConstraint(.)):
Code: Select all
btScalar vel1Dotn = solverConstraint.m_contactNormal.dot(body0?solverBodyA.m_linearVelocity:btVector3(0,0,0))
+ solverConstraint.m_relpos1CrossNormal.dot(body0?solverBodyA.m_angularVelocity:btVector3(0,0,0));
btScalar vel2Dotn = -solverConstraint.m_contactNormal.dot(body1?solverBodyB.m_linearVelocity:btVector3(0,0,0))
+ solverConstraint.m_relpos2CrossNormal.dot(body1?solverBodyB.m_angularVelocity:btVector3(0,0,0));
rel_vel = vel1Dotn+vel2Dotn;
i.e. velocity stored in
btSolverBody object is used which is the current step velocity before correction (updated precisely in the code snippet you pasted).
Erin's slides (e.g. Modeling and Solving Constraints, 2009, pages 47-56) suggest the 2nd option but it could well be that you have established an alternative version which I am simply unaware of and this what made me create this thread

.
Erwin Coumans wrote:I discussed with Erin to process forces inside the solver, instead of applying them beforehand, and he agreed that is a better approach.
I am afraid I don't understand what you meant - inside the solver meaning during SI? But I can't see external forces used there - all I can see are velocity and position errors being corrected with impulses established using effective masses. Have I missed something essential?
Last but not least: I know that there has been the anti-jitter contact handling alteration about a year ago (I have linked the discussion in the original post), which explains the "funny" way of evaluating contact constraints target velocity for SI, but it does not seem to really explain the apparent inconsistency (which probably exists only in my imagination

) described above.
Cheers

,
kalesony