5.78. TouchSensor (media-object)

<touchSensor> ‐ A touchSensor that detects an intersection with the bounding boxes of media objects

5.78.1. Attributes

NameTypeDefaults
idIDNone (required)
x1FLOAT0.0
y1FLOAT0.0
z1FLOAT0.0
message_inSTRINGsensor-touchSensor-in
message_outSTRINGsensor-touchSensor-out

5.78.2. Description

This element defines a touchSensor inside a scene graph. There can be several touchSensors inside a scene. Each touchSensor send messages to a media object every times it enters or leaves the bounding box of the nearest testable media object. The boolean value of the testable attribute define whether the object can be selected by passive selection through a touchSensor (see Section 2.6.1).

The float values of the x1, y1, and z1 attributes define the translation of the touchSensor in its local coordinates. The string values of the message_in, message_out attributes define the message strings that are sent to the nearest testable object intersected by a touchSensor.

5.78.3. Expected child

None.

5.78.4. Example

The example below defines a touchSensor located at the origin of its local coordinates. The messages received by the objects intersected by the sensor are sensor-exper-in and sensor-exper-out.

<touchSensor id="touch_sensor_cam2" x1="0.0" y1="0.0" z1="0.0"  
          message_in="sensor-exper-in" 
          message_out="sensor-exper-out"/>