<<VRML 2.0 - An Introductory view by examples

PlaneSensor

[example]                                         [run-example]


This node maps pointing device motion (e.g. mouse) into 2D translation (translation_changed) in a plane parallel to the Z=0 plane of the local coordinate system. Event generation occurs if the device touches any of its parent's descendent geometry.

{
exposedField SFBool autoOffset TRUE # when TRUE offset is sent for device deactivated
exposedField SFBool enabled TRUE # if FALSE disabled
exposedField SFFloat maxPosition -1 -1 # (x,y) max position value
exposedField SFFloat minPosition 0 0 # (x,y) min position value
exposedField SFRotation offset 0 0 0 # value added to each actual sensor change
eventOut SFBool isActive # signalizes device is activated
eventOut SFVec3f translation_changed #
eventOut SFVec3f trackPoint_changed #
}

The max and minPositions parameters permit to implement line sensors and to control values range.

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 PlaneSensor { }

           DEF TRAN Transform {
               some geometry 
                      }
                ]
          }

    ROUTE SENSOR.rotation_changed TO TRAN.set_rotation