if touched, it falls, and you can see the controller try to correct to a new equilibrium state.
I did this, and after it has fallen, i have picked it up to hold it up in air. I've picked the box between it's center and the corner top left side of the blue face. A bug has shown up.
First it behaved correctly (did nothing), but then it started to rotate at constant angular velocity. The rotation started instantly, and the constant velocity never changed its value.
I let it fell down to the floor, but the rotation did not stop. It kept rotating, rolling over it's edges and faces over the floor.
Angular velocity did not change from the contact with the ground. Also the axis of rotation remained constant all the time.
Could not reproduce this a second time, but maybe you can make some sense out of it.
Now that i think of it, maybe the ball started spinning very quickly, causing some flywheel effect.
But then i should have noticed the spinning after some time, even if one revolution closely matches gfx refresh rate, which i didn't.
after doing that, the model still fail, but after a debug section I found that to predict the next step, the model most calculate the new contacts for state S' in Post Update
Because the contacts are still the values of state S, so after doing that fix.
That's interesting. I've tried PostUpdate too but it did not work. Maybe i miss something.
Here is your explanation of the pipeline, but i add my assumptions into braces:
-collision update (Just collision detection, but no contact force calculation yet?)
-dModel update
-Constraimt solver update (Solve both contact and joint forces?)
-dModel post update
-Integration
So if you do everything in post update, you do know exact contact forces, if that helps?
But then i wonder, the joint motor acceleration you also set here will be not considered in the following integration, but only one step later in the future solver update?
That's confusing, but i'll keep experimenting with doing some or all things in post.
Btw, the covariance matrix in your code isn't used.
That's something i want to learn about sometime soon.
I guess you could use it to find the ideal orientation for a virtual single body to define inertia, matching many smaller bodies?
Or you could do something like finding a good orientation of an oriented bounding box over a point set?
If you have related examples in your code, please let me know. Learning from formulas is always hardly possible for me.
I also need to learn what gyro torque is. Maybe that's something i ignore, explaining some of my problems.
Very interesting to follow.