Creating a scene procedurally

11 May Creating a scene procedurally

The process to create a scene procedurally with SOFA Front-end is easy as you do not have to manipulate the (complex) template types of your objects. It is very similar to what you do when you create a scene through a Xml file.

The creation is quite straightforward: you just have to call the createObject method on handle of the parent node. This method will call the factory of the object and will insert it under that node. If you want to set the value of some data, you can do it using an initializer list.

7
8
9
10
11

// Creates the object FreeAnimationLoop and place it under root
root.createObject("FreeMotionAnimationLoop");// Creates the object LCPConstraintSolver and sets tolerance to 0.001 and mu to 0.8
root.createObject("LCPConstraintSolver", {{"tolerance", "0.001"}, {"mu", "0.8"}});