understanding btPoint2PointConstraint and JacobianEntry

acx01b
Posts: 10
Joined: Thu Jan 15, 2009 12:42 pm

understanding btPoint2PointConstraint and JacobianEntry

Post by acx01b »

Hello,

I'm still trying to understand how joints are corrected in Bullet and in physic simulation in general

in btJacobianEntry(...) there is a number m_Adiag calculated as follow :
with btVector3 currentAxis = (1,0,0), then (0,1,0) and then (0,0,1)

btVector3 A_ContactPos = A_jointPosWorld - A_centerOfMassWorld;
btVector3 B_ContactPos = B_jointPosWorld - B_centerOfMassWorld;
btVector3 m_aJ = A_inverse_transform * ( A_ContactPos.cross( currentAxis));
btVector3 m_bJ = B_inverse_transform * ( B_ContactPos.cross(-currentAxis));
btVector3 m_0MinvJt = inertiaDiagInvA * m_aJ; // vector3* vector3 <=> diagonal matrix * vector3
btVector3 m_1MinvJt = inertiaDiagInvB * m_bJ;
btScalar jacDiagABInv = massInvA + m_0MinvJt.dot(m_aJ) + massInvB + m_1MinvJt.dot(m_bJ);

it is then used in btPoint2PointConstraint::solveConstraintObsolete(...) :

btScalar deltaImpulse = (depth/timeStep - rel_vel ) * jacDiagABInv;
depth is the positionnal error on axis (1,0,0) { and then (0,1,0) , (0,0,1) ... }
depth/timeStep is the impulse to apply to get the positionnal error corrected
rel_vel is the current velocity difference on axis (1,0,0)

so if you calculate the impulse magnitue like this : (depth/timeStep - rel_vel) you will have the error completly corrected at the next time step
and you apply a : "invMassA/(invMassA + invMassB)" part of the impulse to body A, and
the other part: "-invMassB/(invMassA + invMassB)" to body B

but there, because of that jacDiagABInv , it is not invMassA/(invMassA + invMassB) witch is applied
but invMassA/(massInvA + massInvB + m_1MinvJt.dot(m_bJ) + m_0MinvJt.dot(m_aJ) )

so what is that m_1MinvJt.dot(m_bJ) + m_0MinvJt.dot(m_aJ) and why is it usefull ??

thank you if you read me and much more if you can answer,
Renaud