Not sure if this happens because of numerical integration errors or if it's an actual bug but when I create a simple dCustomBallAndSocket joint and the set the linear and angular damping of the body to 0 and give the body a little push the body is quickly gaining extra energy and finally explode.
Easily recreated in the sandbox by modifying this function in standardjoints.cpp
- Code: Select all
static void AddDistance (DemoEntityManager* const scene, const dVector& origin)
{
dVector size (1.0f, 1.0f, 1.0f);
NewtonBody* const box0 = CreateBox(scene, origin + dVector (0.0f, 6.0f + size.m_y + 0.25f, 0.0f, 0.0f), size.Scale (0.2f));
NewtonBody* const box1 = CreateCapule (scene, origin + dVector (0.0f, 6.0f, 0.0f, 0.0f), size);
//NewtonBody* const box2 = CreateCapule (scene, origin + dVector (0.0f, 6.0f - size.m_y * 4.0f, 0.0f, 0.0f), size);
dMatrix pinMatrix (dGrammSchmidt (dVector (0.0f, -1.0f, 0.0f, 0.0f)));
NewtonBodySetMassMatrix(box0, 0.0f, 0.0f, 0.0f, 0.0f);
// connect first box to the world
dMatrix matrix0;
NewtonBodyGetMatrix (box1, &matrix0[0][0]);
pinMatrix.m_posit = matrix0.m_posit + dVector (0.0f, size.m_y, 0.0f, 0.0f);
new dCustomBallAndSocket (pinMatrix, box1, box0);
dVector damp(0.0f);
NewtonBodySetLinearDamping(box1, 0);
NewtonBodySetAngularDamping(box1, &damp[0]);
//// link the two boxes with a distance joint
//dMatrix matrix1;
//NewtonBodyGetMatrix (box2, &matrix1[0][0]);
//// get the origins
//dVector pivot0 (matrix0.m_posit - dVector (0.0f, size.m_y, 0.0f, 0.0f));
//dVector pivot1 (matrix1.m_posit + dVector (0.0f, size.m_y, 0.0f, 0.0f));
//// connect bodies at a corner
//new dCustomPointToPoint (pivot1, pivot0, box2, box1);
}