I have read the basics of how force based physics simulation works and how you can create joints by enforcing certain constraints on the forces between two rigid bodies. What is unclear to me is what happens during the integration step.

In particular even if you enforce the constraints on the forces - during the integration step the bodies will still move out of alignment. By this I mean the hinge will seperate. What is the next step to address this?

How do you translationally re-align the bodies in a way which is consistent with classical mechanics? If you choose one piece as the "ground truth" and basically re-align all the connected pieces to it, you are biasing the evolution of the system to be around that piece which can't be correct.

  • $\begingroup$ I'm not sure what you mean by "re-align". In a traditional velocity- or force-based constraint solver, the correcting impulse/force is applied at every time step precisely because the other forces on the body break the constraint every time it is updated. So perhaps I'm misunderstanding your question, but why isn't the answer "just impose the constraints again"? $\endgroup$ Jun 27 at 2:28
  • 1
    $\begingroup$ The instantaneous force needed to maintain equality constraint isn't valid over the whole timestep so without correction the next iteration of the algorithm with have rigid body positions violating the constraints, right? The joints come apart? Do you just ignore this fact and allow some error and hope the next iteration will nudge the joints so they always stay approximately correct? $\endgroup$ Jun 27 at 3:04
  • $\begingroup$ Yes, exactly, it's just the limitation of a discrete time-step. In fact, enforcing the constraints too rigidly will even lead to jittering. Or at least that's what you do for game physics engines, I have no idea what the high-society render physics community does. $\endgroup$ Jun 27 at 3:12
  • $\begingroup$ When looking at the animations though it doesn't seem like error exists, are the animations decoupled from the physics so equality constraints are maintained exactly? How? $\endgroup$ Jun 27 at 3:32
  • $\begingroup$ Well, most engines have separate update loops for rendering and physics updates, and presumably there are some interpolation schemes to keep the animation smooth. But a good constraint solver would keep the constraint error minimal anyway. $\endgroup$ Jun 27 at 3:40

Here is the robotics approach to this problem.

What you need is the kinematic relationship between bodies that always satisfies the joint. This relationship connects the joint coordinates (angles, distances, etc) and their derivatives to the cartesian motion vectors of each body. The goal is to define the configuration of the system in terms of the joint degrees of freedom.

Then you can reduce the system into an ODE in terms of the joint coordinates which you integrate. As a post processing step for each time frame $t$, joint positions $\boldsymbol{q}$, joint velocities $\boldsymbol{\dot q}$ and joint accelerations $\boldsymbol{\ddot q}$ can yield the full motion and force description of each body.

The easiest problems to formulate are those of where each body is connected with a joint to a single parent body, and the common parent of all bodies is the immovable ground. These tree like systems have recursive algorithms that produce almost analytical results.

Next in complexity would be problems where there are kinematic loops joining different branches of the tree together that require additional constraint forces to enforce all the loops.

Finally is the problem of a free floating system of bodies which may not have a common parent body to define all other body configurations relative to. In this case you have to mix the robotic joint coordinates $\boldsymbol{q}$ with a standard rigid body parametrization of position and Euler angles, or quaternions and integrate everything at the same time.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.