Skip to content

Connection State Controller

Description

This controller outputs the active/inactive state of a connection.

Syntax and Default Values

The connection-state controller can be created using the following Lisp or mlys.lua syntax:

(make-controller 'connection-state
                  dimension
                  connection)
modalys.create_controller{kind="connection-state",
                          connection=[any connection reference]}

Parameters

The 'connection-state controller takes two arguments:

  • dimension: always 1 (automatic in Lua).
  • connection: a reference to a connection.

Discussion

This controller outputs the active/inactive state of a connection. The controller value is 0 when the connection is inactive (objects are not interacting), and 1 when the connection is active (objects are touching/interacting). It could be used, for example, to modify the values of some parameters based on whether on or not two connected objects are touching. Obviously to use it, the connection itself must be given a variable name, as shown in the following example, which uses the pluck connection in Modalys example 1, and makes a controller from the connection state (and shown in the graph, above):

(setq my-connection (make-connection 'pluck my-string-plk 0 my-plectrum-plk .1 (const 50)))
(setq my-state-ctl (make-controller 'connection-state 1 my-connection))

★     ★