I found a bug in the joints functionality. I added an extra two test classes:-
TwoBodyHingeTest and TwoBodyBallTest,
the previous two test classes were two complicated. These tests just join a joint between two bodies and test the functionality. I have also refactored the way testing is done. The 4 joint test now extends TestingWorld, which sets up the screen and gives the tests a step() method for the main to call. Its alot cooler, but no collisionManager is present (as it is not needed for these simple tests)
I found an error in the joints which was actually a common execution pathway for both of them (so it was not the physics intergrator). In seting up the joints constraints they both build from a ball joints constraints with a method called setBall(Joint joint, Joint.Info2 info, Vector3 anchor1, Vector3 anchor2)
It is in the info object where the jacobian matrices are placed. anyhow the mistake I made when porting was to call the following method
MathUtils.dCROSSMAT_MINUS_PLUS(info.J1a.getData(), a1, s);
dCROSSMAT_MINUS_PLUS takes 2 Real as parameters, but J1a is a RealPointer. So I just used the data inside the jacobian RealPointer.
However, ODE is very clever in the integrator. ODE uses ONE big block of data with different pointers to the data, so in actual fact the index to the data needs to be taken into account.
So I upgraded dCROSSMAT_MINUS_PLUS to take two RealPointers and to take into account the indexes of the pointers when doing the math
then the call in the setBall became:-
MathUtils.dCROSSMAT_MINUS_PLUS(info.J1a, new RealPointer(a1), s);
Note I had to wrap a1 which was of type Real with a tiny instanciation of a RealPointer. This is fine and is all over the code, its best to make the math code as flexible as possible becuase we might never know when the 2nd parameter is stored in a clever way.
Anyway. the point of this is that the TwoBodyBallTest works for the Cholesky & the LCP intergrator! Ball joints are on the road to working! The don't work in BallAndSocketTest, and the hinges do not work yet, but definatly we are getting somewhere now.
BTW if you get an error message saying A is not a posative definate that means the Cholesky intergrator is turned on, switch it in step_island_x1, I think I may have commited that change