is the capsule is tight inside the four boxes?
this lead to a singular mass matrix for the contact on each capsule, you need to leave some wiggle room for the contacts.
you can also try the soft contact option, the will relax the contact mass matrix, but that is a new feature you need to add it to your contact call back, in your contact call back you add something like this
- Code: Select all
static void TestSoftContacts(const NewtonJoint* const contactJoint, dFloat timestep, int threadIndex)
{
dAssert(NewtonJointIsActive(contactJoint));
for (void* contact = NewtonContactJointGetFirstContact(contactJoint); contact; contact = NewtonContactJointGetNextContact(contactJoint, contact)) {
NewtonMaterial* const material = NewtonContactGetMaterial(contact);
NewtonMaterialSetAsSoftContact(material, 0.1f);
}
}
this will make the diagonal of the block contact matrix larger to eliminate the ill conditioning.
and add penetration penealty on teh right side to make for the deficiency.
in matrix talk, say you have a circle sandwiched between a left and right wall with no room to move.
this will form a matrix of the form
1 -1 x0 = b0
-1 1 x1 = b1
this matrix is singular and can't be solved because the detereminat is zero.
Even using singular value decomposition yield a wrong answer because SVD tell to remove one row, setting the force in one wall to zero.
but the required answer is that both walls assert force of the *, not that one wall is removed from the solution.
the option NewtonMaterialSetAsSoftContact(material, 0.1f), modify the matrix like follows
(1+0.1) -1 x0 = b0 + penaty0
-1 (1+0.1) x1 = b1 + penaty1
now the determinat is a small value which allows to get a close solution to the ideal one.
and the penealty on the right side make up for the small penetration value.
this feature seems to work very well, but I have not tried much.