Skip to content

Sensors and Actuators

ssatguru edited this page Apr 13, 2016 · 18 revisions

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

You can attach sensor and actuators to any object in Vishva.

You can attach multiple sensors and actuators to an object.

Sensors make objects sense events or happenings in the world and emit a signal ( a signal is any arbitrary string).

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 anybody emits the signal "foo".

So now whenever 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 use 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 common properties and some properties specific to that sensor or actuator. Lets looks at these 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

Actuator

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