<<VRML 2.0 - An Introductory view by examples

CylinderSensor

[cylinder-sensor example]                             [run-example]


This node maps pointing device motion (e.g. mouse) into a rotation (rotation_changed) on an invisible cylinder aligned with the Y-axis of the local coordinate system. Event generation occurs if the device touches any of its parent's descendent geometry. The diskAngle parameter defines the behavior of the invisible cylinder as a disk (angle between the cylinder local Y=0 axis and bearing vector lower than diskAngle) or as a cylinder (angle greather or equal than diskAngle).

{
exposedField SFBool autoOffset TRUE # when TRUE offset is sent for device deactivated
exposedField SFFloat diskAngle 0.262 # threshold for disk/cylinder behavior
exposedField SFBool enabled TRUE # if FALSE disabled
exposedField SFFloat maxAngle -1 # used for rotation_changed clamping
exposedField SFFloat minAngle 0 # if minAngle > maxAngle no clamping
exposedField SFRotation offset 0 1 0 0 # value added to each actual sensor change
eventOut SFBool isActive # signalizes device is activated
eventOut SFRotation rotation_changed #
eventOut SFVec3f trackPoint_changed #
}

Usage :

here the touch of the geometry (contained in the Transformation node) will
generate events, which will be directed to the Transformation node (TRAN).

    Group{
      children [
           DEF SENSOR CylinderSensor { }

           DEF TRAN Transform {
               some geometry 
                      }
                ]
          }

    ROUTE SENSOR.rotation_changed TO TRAN.set_rotation