Creation of a Scene (6/9)


Description

We will now replace the PlaneForceField with a true obstacle, modeled with a topology (read from a mesh file), a mechanical object, and some collision models.

Key points

To use the Collision Pipeline described here, you need to use Collision Models. They describe geometrical primitives which will be involved in the collision detection. To demonstrate the flexibility you can have, we will use at the same time some spheres, triangles, lines and points.
There will be as many spheres as particules contained in the Topology.

Add a new GNode to the root node, and rename it "Obstacle".

Add a MeshTopology component to the Obstacle node. Set the Filename of the mesh to mySofaDirectory/Sofa/share/mesh/cube.obj.

Add a MechanicalObject to the Obstacle node. Change to the Transformation tab, and change the Scale of the DOFs in 3 dimensions from (1 1 1) to "(40 40 0.1)".

Add a TTriangleModel to the Obstacle node. In the Property 2/3 tab, change the Default contact stiffness to 500. Repeat both steps with a LineModel and a PointModel

Add a OglModel component to the Obstacle node. In the Property 2/3 tab, set the Path to the model to /Sofa/share/mesh/cube.obj. In the Transformation tab, change the Initial Translation of the object to "(0 0 -10)" and the Initial Scale of the object to "(40 40 0.1)".

Results

Delete the PlaneForceField. Run in SOFA and animate.

At this point, our deformable object will interact with the floor using spheres placed at each particle. The collision detection does not take correctly into account what we visually see, but the dragon does not pass through the floor.

Related

You have several way to modify the collision detection and response.

Modify the proximity distance to know when two primitives are colliding: open MinProximityIntersection and edit "alarmDistance" and "contactDistance".

Modify the stiffness of the response: the response is computed using the product of the contactStiffness of the two collision models involved. Open SphereModel and edit this parameter. You can do the same process with the TTriangleModel, LineModel, PointModel.


Previous ____________ Next