Skip to content

Sensors and Actuators

Satguru P Srivastava edited this page Mar 2, 2017 · 18 revisions

about

Sensors and Actuators provide a quick and easy way to add behaviors to your scene without doing any coding.

You can attach one or more sensor and/or actuators to any object.

Sensors make objects sensitive to certain events or happenings in the world and emit a signal ( a signal is any arbitrary string) when those events or happenings happens.

Actuators make objects do something whenever a signal is emitted in the world.

Here is a simple example.

Attach a "touch sensor" to an object and set the signal id to, lets say, "foo" This "sensor" makes an object sensitive to a mouse click. So now whenever the user clicks the object, the object will emit the signal "foo".

Attach a "rotator actuator" to another object and set its signal id to "foo". This will make the actuator rotate the object whenever somebody emits the signal "foo".

So now whenever the user clicks the first object the second object will rotate.

You could attach a "mover actuator" to a third object and set the signal id to the same "foo"

Now when the user clicks the first object , the second object will rotate and the third object will move.

Further for each actuator you can specify a start signal and/or an end signal. If you do so then every time the the actuator starts actuating an object it will emit a start signal and whenever the actuation ends it will emit an end signal. These signals can now trigger other actuators. This way you can chain actuators together.

As you can see, lots of possibilities.

All sensors and actuators have some properties common to all and some properties specific to each.

Lets looks at the common properties first

sensors

property description
signalId this is the signal emitted by this sensor whenever an event , to which it is sensitive to, happens

actuators

property description
signalId this is the signalId to which an actuator reacts to. It actuates whenever something emits this signalId
autostart if set to true the actuator actuate or starts immediately after you are done editing the object.
loop if set to true the actuator starts up again immediately after it stops. Does not wait for a signal to start it up again
toggle if set to true the actuator behaves in the "opposite" manner each time. So for "mover" the first touch might move the object forward, the second backward, third forward and so on. Some actuator , like sound, ignore this
startSignalId this signalId is emitted by the actuator when it starts actuating
stopSignalId this signalId is emitted by the actuator when it stops actuating

In addition to the above properties, each sensor and actuators may have have properties specific to them.

Each sensor and actuators have their own separate documentation (TODO). See them for these specific properties

adding sensors and actuators

select the object you want to add sensor or actuator to.

from the edit dialog box select "Sensors & Actuators"

another dialog box will open up with two tabs - one for selector another for actuator

each has a drop down box with a list of available sensor and actuators

select one and click add button to add one with default properties

click edit to edit various properties

note: when an object is selected, sensors or actuators on that object are disabled. They get re-activated the moment you deselect the object.