Collision Pipelines: DefaultPipeline
The DefaultPipeline is a Collision Pipeline. It performs steps related to the collision, mainly collision detection and collision response.
The animation loop executes the 3 steps of the pipeline (see documentation on Collision Pipeline).
Interaction with Other Components
DefaultPipeline requires other components defined in the same context:
- An intersection method (e.g. MinProximityIntersection, LocalMinDistance)
- A broad phase detection (e.g. BruteForceBroadPhase)
- A narrow phase detection (e.g. BVHNarrowPhase)
- A contact manager (e.g. DefaultContactManager)
- [optional] A group manager (e.g. DefaultCollisionGroupManager)
If no intersection method is provided, a default DiscreteIntersection component is created and added to the scene graph, with a warning to the user, and used as the intersection method.
Here is a description of the 3 steps of the pipeline:
This step mainly clears data computed from the previous time step. It is implemented in the function
- All the contacts provided by the contact manager are cleared.
- The group manager clears its groups
- For all collision models, computes its bounding tree. The depth of the tree is defined by a Data in DefaultPipeline. If the broad phase or the narrow phase does not require a deep tree (
needsDeepBoundingTree()), the tree is minimal. In any case, a CubeCollisionModel is created and linked to each collision model, to be used as a Axis-Aligned Bounding Box in the broad phase. Building the tree takes into account whether the collision detection is continuous or not. This is defined in the intersection method.
- Executes the broad phase collision detection
- Executes the narrow phase collision detection
Collision detection is implemented in the following function
- Create contacts in the contact manager, based on the result of the collision detection
- Create response for all pairs of intersecting collision models, which one is not simulated
- Create response for the rest of the pairs of intersecting collision models (the ones which are simulated). This step can be performed by the group manager if any.
Creation of the response depends on the type of contact defined in the contact manager.
Collision response is implemented in the following function
void DefaultPipeline::doCollisionResponse(const helper::vector<core::CollisionModel*>& collisionModels)
Example of Usage
This component is used as follows in XML format:
<FreeMotionAnimationLoop /> <DefaultPipeline depth="15" verbose="0" draw="0" /> <BruteForceBroadPhase name="N2" /> <BVHNarrowPhase/> <MinProximityIntersection name="Proximity" alarmDistance="1.5" contactDistance="1" /> <DefaultContactManager name="Response" response="FrictionContact" />
Note DefaultPipeline is defined alongside other required components.
Read more on SOFA API documentation
Last modified: 15 May 2023