Information

This API is still work in progress. It correspond to the deeper level of API where all edition between SofaUnity components will be possible. It can be seen as an alternative to the scene file or the python scripts usually used by SOFA users.

For the moment those features should only be used to finalise the simulation graph of a loaded scene. Several components, described below, are already available and it is also possible to manually add new SofaDAGNode in the simulation graph.

SofaComponent specialization

As explain earlier in the SOFA Scene Parsing section. Several categories of component from SOFA are mapped as Unity3D specialized GameObject. The others are created as SofaComponent generic GameObject.

Those specialized implementation allows for example to see the multi-model representation of a 3D object. In the Liver scene it is possible to see the visual

Classic visual rendering of the object using MeshFilter inside the compnent SofaVisualModel.

FEM element can be displayed inside the SofaFEMForceField by activating the Mesh Renderer.
Note that it can slow down the simulation as for example the tetrahedron in this case need to be updated at each frame.

Collision model can also be displayed in the SofaCollisionModel by activating the option Draw collision elements.
Note that same as for FEM, this can slow down the simulation as the element need to be updated at each frame.

Specific SofaComponent

Several very specific components can be created on top of the simulation scene graph using the hierarchy panel.

1. SofaBeamModel

This component is used to create a visual rendering in Unity3D of a Beam simulation in SOFA. It should be created inside a node having a SofaMesh with a Edge topology. Check the demo scene BeamDemo.

This component has 3 parameters:

  • SofaMesh: Link to the corresponding SofaMesh with the beam structure.
  • Discretisation: Number of face wanted for this beam.
  • Radius: Radius of the visual beam around the simulated structure.

Example of a beam with a high dicretisation value of 10

Same beam with a discretisation value of 2

2. SofaParticlesModel

This component is used to create a visual rendering in Unity3D of a SPHFluid simulation in SOFA. It should be created inside a node having a SofaMesh with a Point topology. Check the demo scene SPHFluid.

This component is used to create a visual rendering in Unity3D of a Beam simulation in SOFA. It should be created inside a node having a SofaMesh with a Edge topology. Check the demo scene BeamDemo.

This component has 3 parameters:

  • SofaMesh: Link to the corresponding SofaMesh with the beam structure.
  • Discretisation: Number of face wanted for this beam.
  • Radius: Radius of the visual beam around the simulated structure.

3. SofaCollisionPipeline

This component will create the default collision pipeline used in SOFA. See this IntersectionMethod on the SOFA webiste documentation for more information. This Will automatically create a GameObject embedding. It is not yet possible to change the type of algorithm used :

  • Collision Pipeline: DefaultPipeline
  • Broad Phase: BruteForceDetection
  • Narrow Phase: MinProximityIntersection
  • Collision Response: DefaultContactManager