There was no plane joint ported to OgreNewt. So basically in my update function, I set each z-velocity to zero.
yes that's but we have it for some time now and this is the correct way to do what you want.
in fact for all you object that live in flat land, the Plane Joint is the only joint allowed.
all othe sould be subclassed from that one an only dPlaneJoint base class.
later I will make you an 2d upvector and a 2d hinge and I with posted here. so tha you take and use in you code.
That should be all you nee for your game.
so to summarize, your fiert step are this.
1-comment out all you code that is using any kind of joints, all of it.
In fact so confident I am that you can jsut delete it, but do no do that keep for reference for what you do next.
2- to every dynamic object (object that non zero mass) assign a plane joint at creation time.
the joint can be a member of your class so that you have handy.
3-at this stage your game should be almost fully working, but there will be not player or not ragdoll.
but not weird physics behavior like explosion or warnings in debug mode.
4- when I post the 2dupvector, for each player in your game, you delete the plane joint and attach an 2d up vector. This will make your player work and interact nicely with everything since the 2dupvector is also an plane joint that constraint the plane angle.
5- now your entire game should run as is doing now but there will be not ragdoll yet.
after the game is running smooth without weird behavior, you move to add rag doll.
6-to make a rag doll, for each body that will be part of the ragdoll you do as follows.
delete the plane joint for all on them except for the root body.
this is for each child of a parent node below the root of teh doll,
delete the plane joint that force the body to move in the plane and replace
it with a 2d hinge joint that will allow the child only rotation relative to it parent.
since the parent will still be constrained to the plane of the scene, then all children will also be constrained to the plane of the scene.
those step should provide with the most accurate, stable and faster scene that you will get using newton, and sould no be that much work to get in fact is should be far simpler than
how you are doing I now. How you are doing it now should not even work at all.
the more I move Newton to correctness the more the ill form configuration will be exposed.
this was why the LDLt transformation blue up, because is not tolerant of ill condition matrices.
I am glad and grateful it blue up because, in a physics system there are legitimate reason why a matrix can be ill condition and still legal and that was my be mistake, so I get to correct that.
The point I am making is that if a Matrix is ill condition, then it can be substituted with a pseudo matrix by a trick called regularization, but that can only be done using Cholesky.
since I was using cholesky before, your game was working but is was because the solver was constantly repairing that mass matrix, hence hiding the problems.
The regularization trick should be an extreme rare citation that sould only happens when configuration have difficult loops, this is not your case.
anyway I hope the guidelines above help you to get the game going,
and later today I will write the two joints that you need for teh rest.