Interacting with the simulation

31 Mar Interacting with the simulation

In this post we explain how use the Blender Logic Editor to interact with the objects in your Blender SOFA simulation.


First, create a small scene containing only a cube and a plane.

Activate collisions for both objects and activate Sofa Physics for the cube.


What we are going to do now is to create some sensors that will be activated when some event occur, and some Actuators, that will describe how the simulation reacts to those events.


Change the bottom windows to the “Logic Editor”. Increase the size of that windows so it is comfortable to work with.


Select the cube. Press the “Add Sensor” button in the “Logic Editor” and choose, for example “Keyboard”. Select the key you want by clicking on the small widget right to the “Key:” label and by pressing the desired key on the keyboard, in our case, the “Left Arrow”.

Press the “Add Activator” button, and choose “Motion”. In the first line (“Loc:”), change “X” to “0.1” for instance.


Now link the Sensor and the Actuator by clicking on the black dot at the right of the Sensor and drag to the circle at the left of the Actuator. The two widgets will now be joined.

When you start the simulation, pressing the Left Arrow will change the position of the cube.

You can create more Sensors and Actuators to bind the other arrows, to mouse click

Rather than “Loc:”, you can act on the Rotation of the object, apply a force or a torque, or change its linear or angular velocity. Note that torques and rotation only works for Rigid objects. The “L” switchs at the right of each line indicate the use of object coordinates rather than scene coordinates.



No Comments

Sorry, the comment form is closed at this time.