I added a test that after 500 frames, the force callback stops applying acceleration, under these circumstances the body should not gain momentum at all, omega should change but its magnitude and the product on the angular velocity and the moment of inertia should be constant as well.
the change is this
- Code: Select all
void OnApplyExternalForce(dInt32 threadIndex, dFloat32 timestep)
{
static int xxxx;
dVector omega(GetBody()->GetOmega());
dTrace(("%d wMag = %f w(%f %f %f)\n", xxxx, dSqrt(omega.DotProduct(omega).GetScalar()), omega.m_x, omega.m_y, omega.m_z));
if (xxxx > 500)
{
return;
}
ndDemoEntityNotify::OnApplyExternalForce(threadIndex, timestep);
xxxx++;
if (xxxx > 500)
xxxx *= 1;
}
so now all that remain is to make that fix without affecting the rest, I see if I can get it today.
you can see that the magnitude of omega does increases over time but very very slowly, this is something that can not be solved because if just a fact that numerical integration is never exact. but that can be fixed by adding just a tiny bit of drag, and the simulation become indistinguishable from a reality which is my goal.
It is only when you get a simulation that can reproduce the known cases, that you can trust a predictions of the unknown cases.