A SERVICE OF

logo

130
Chapter 11: Sensors
csPlaneSensor
A csPlaneSensor maps the drag motion of a pointer devices events into a translation in
the XY plane of the local or world coordinate space, depending on the value specied by
csPlaneSensor::coordFrame().
Setting Up csPlaneSensor
A typical use of csPlaneSensor is to connect its output event, translation, to a
transformation node. The effect of the sensor when combined with a transformation
node is to translate associated geometry in local or world space along the XY plane
according to the dragging motion of a pointer device: dragging the pointer device to the
right moves the geometry to the right; dragging the pointer device up moves the
geometry up.
To enable csPlaneSensor to translate geometry, you must complete the following two
tasks:
1. Connect a csPlaneSensor node to a csTransform node, as follows:
csPlaneSensor *planeSensor = new csPlaneSensor;
csTransform *transform = new csTransform;
planeSensor->connect(csPlaneSensor::TRANSLATION, transform,
csTransform::TRANSLATION);
Translation events are generated by csPlaneSensor.
2. Add the csPlaneSensor node as a child to the parent node of the transformation
node associated with the geometry to translate, as shown in Figure 11-2.