### Creation of a Pendulum (7/8)

Description

To link the two different mechanical objects, we will create a spring between them.

Find the SpringForceField component. Drag and drop it on the root node. The Modeler will warn you "No MechanicalState found in your Node root". Press Ignore. We will define what the ForceField should act on manually.

Double click the new SpringForceField to edit its properties. Towards the bottom of the window, in the First object in interaction textbox, type "FirstObject". In the Second object in interaction textbox, type "SecondObject".

Go to the Property 2/2 tab, increase the spring's pairs of indices, stiffness, damping, and rest length to 1, and press Display the values, then Update. Fill in "1", "0", "10", "0.1", and "1" in the columns Index1, Index2, Ks, Kd, and L respectively.

Run the scene in SOFA. Click the Graph tab.

Key points

We use the same component as in the previous part of the tutorial (SpringForceField). But you may notice the the colour used in the SOFA scene graph is not the same. Internal Springs use a blue color, while Interaction Springs use a red colour. The difference with the previous use of the SpringForceField resides in the fact that we need to specify the two mechanical objects in interaction: we specified the MechanicalObjects FirstObject and SecondObject. The creation of the springs is exactly the same: two indices, Ks, Kd and rest length. The second spring is displayed in green, representing the interaction between the two objects.

Results

To get a better view of the simulation, reduce the integration time step by finding the DT textbox on the top left of the SOFA window, and changing it from 0.01 to "0.001". Press Animate.

### Previous ____________ Next