But it's black magic to bring if from there to a proper game-ready physics engine which can handle 30 stacked boxes and complex penetration problems.
There is a reason that there are very few physics engines compared to game engines.
But it's black magic to bring if from there to a proper game-ready physics engine which can handle 30 stacked boxes and complex penetration problems.
There is a reason that there are very few physics engines compared to game engines.
Maybe it's just using a really tiny physics time step. That allows forces to propagate through the whole pile over many time steps.
Objects might sink into each other a bit, but that is generally not very noticeable unless you make huge piles of spheres. However, it might quickly become a problem in 2D, since you only need a quadratic number of objects to get a "critical" pile, compared to a cubic number of spheres in 3D.
Not to discount the effort involved here though; it's pretty impressive, I know I couldn't write this without a lot of mental effort.
I think of a Jacobian as a way to transform the velocities from however they're stored for the interacting objects into linear world-space velocities.
For example, in 2D rigid body physics, rotational velocity is usually just a single number representing how fast something is spinning. Given a radius from the center of a spinning object (e.g. object origin -> a contact point in world space), the instantaneous linear velocity is the rotation speed times the tangent to that radius. Therefore, the Jacobian is just that tangent vector - multiplication by that vector transforms scalar rotational velocities into 2D linear velocities. The Jacobian for the object's linear velocity is just the identity matrix.
The rotation Jacobian is more complicated in 3D and 4D, but the principal is the same - find a matrix (at a particular point, usually the contact point or the joint location) to multiply with whatever represents rotational velocity to get the linear velocity.
[1]https://box2d.org/files/ErinCatto_ModelingAndSolvingConstrai... [2]http://allenchou.net/2013/12/game-physics-constraints-sequen...