Animation loop
All the scenes in SOFA must include an AnimationLoop. This components orders all steps of the simulation and the system resolution. At each time step, the animation loop triggers each event (solving the matrix system, managing the constraints, detecting the collision, etc.) through a Visitor mechanism (see below). In a scene, if no animation loop is defined, a “DefaultAnimationLoop” is automatically created.
Several AnimationLoops are already available in SOFA:

DefaultAnimationLoop: this is the default animation loop as the name indicates! This animation loop is included by default at the root node of the graph, if no animation loop is specified in the scene. With a DefaultAnimationLoop, the loop of one simulation step follows:
 collision detection is triggered through the collision pipeline (if any)
 solve the physics in the scene by triggering the integration scheme, taking the constraint, collision into account
 update the system (new values of the dofs), the context (dt++), the mappings and the bounding box (volume covering all objects of the scene)

MultiTagAnimationLoop: this animation loop works by labelling components using different tags. With a MultiTagAnimationLoop, the loop of one simulation step is the same as the DefaultAnimationLoop, except that one tag is solved after another, given a list of tags:
 For each tag defined: 1. collision detection is triggered through the collision pipeline (if any) 2. solve the physics in the scene by triggering the integration scheme, taking the constraint, collision into account
 update the system (new values of the dofs), the context (dt++), the mappings and the bounding box (volume covering all objects of the scene)

MultiStepAnimationLoop: given one time step, this animation loop allows for running several collision (C being the number of collision steps) and several integration time in one step (I being the number of integration time steps), where C and I can be different. If the global time step is noted dt, the time integration time is actually: dt’ = dt / (C.I). The loop in one animation step is:
 compute C times the collision pipeline within one time step dt
 For each collision step, solve I times the linear system for time integration using the time step dt’
 update the context, the mappings, the bounding box (the visualization is done once at each time step dt)

FreeMotionAnimationLoop: this animation loop is used for simulation involving constraints and collisions. With a FreeAnimationLoop, the loop of one simulation step follows:
 build and solve all linear systems in the scene without constraints and save the “free” values of the dofs
 collision detection is computed thus generating constraints
 constraints are solved as one system to compute a correction term taking into account the collisions & constraints
 update the mappings, the bounding box
Last modified: 24 March 2021