Sorry for such a massive delay but I completely forgot about that thread...
Okay, I've gone through your equations and the link you provided but it's still not right.
You're saying (and the said link) that to transform tensor you go like transform * tensor * transform^T. But my code doesn't do it. It simply does transform * tensor and it works (in world-space). Look again at the code that computes world-space angular acc:
localToWorld = quaternion.ToMatrix(self.ori) inertia_world = self.inertia_local * localToWorld angAcc_world = vector.Transform(self.totalTorque, matrix.Inverted(inertia_world))
Expanded and written in math notation it would be like:
angAcc_world = self.totalTorque * inertia_world^-1 = self.totalTorque * (self.inertia_local * localToWorld)^-1 = self.totalTorque * localToWorld^-1 * self.inertia_local^-1
Again, localToWorld is only used once, not twice. And this code really works, he simulation behaves in predictable manner, as opposed to any other approach I try.
I don't really know where this:
Finally we define the world space inertia as:
worldSpaceInertia^-1 = localToWorld * localInertia^-1 * localToWorld^T
is taking place in my code.
One thing interesting here is that the last form of this equations could be written like this:
angAcc_world = self.totalTorque * localToWorld^-1 * self.inertia_local^-1 = (self.totalTorque * localToWorld^-1) * self.inertia_local^-1 = totalTorque_local * self.inertia_local^-1 = angAcc_local
Now that is darn confusing. Does it really mean that angAcc in world-space is the same as angAcc in local-space?