This component belongs to the category of Constraint Laws used for the Lagrange constraint resolution and inherits from the PairInteractionConstraint. The UnilateralInteractionConstraint defines an non-holonomic constraint law between a pair of simulated body, i.e. the constraint defined between the pair of objects must have an inequality form:
Such a constraint are used for friction-less and friction contact modeling (it can even be used as a starting point for puncture modeling). For a UnilateralInteractionConstraint, the constraint matrix (derivative of the constraint law) corresponds to:
- for object 1
- for object 2
We can see from these matrices that the UnilateralInteractionConstraint is a transformation towards the constraint space, by building a projection of any field against the contact direction (normal here, and possibly tangential directions as well if friction is defined).
As all constraint laws, the UnilateralInteractionConstraint will be called in the following functions and for the following steps:
getConstraintViolation(): project the free velocity in the constraint space and compute the free interpenetration
buildConstraintMatrix(): build the compliance made up of and
As a PairInteractionConstraint, the UnilateralInteractionConstraint requires the following Data:
- object1: link towards the object 1 to constraint
- object2: link towards the object 2 to constraint
- first_point: index of the constraint on the first model (object 1)
- second_point: index of the constraint on the second model (object 2)
The UnilateralInteractionConstraint can only be used in the context of Lagrange constraint resolution. The scene must therefore contain:
- a FreeMotionAnimationLoop
- a ConstraintSolver
Moreover, each constrained object must define in its node a ConstraintCorrection so that the corrective motion can be applied. Unlike other constraints, the UnilateralInteractionConstraint is mostly used in SOFA for contact modeling. UnilateralInteractionConstraint are therefore dynamically and automatically created within the scene graph when two objects are colliding: when the CollisionPipeline defines new DetectionOutput with ContactResponse using Lagrange multipliers, each DetectionOutput generates a new UnilateralInteractionConstraint.
An example scene involving a UnilateralInteractionConstraint is available in examples/Components/constraint/UnilateralInteractionConstraint.scn. Note that in this example, the UnilateralInteractionConstraint will be created as soon as a contact point is outputed from the collision detection phase.
Last modified: 30 November 2021