126
Chapter 11: Sensors
csSphereSensor
csSphereSensor maps the drag motion of a pointer device into a spherical rotation about
a virtual sphere. The rotation gives the impression that the geometry is attached to the
surface of a spinning sphere.
Virtual Sphere
The center of the virtual sphere is located at the center of either the local or world
coordinate system, based on whether the argument of csSphereSensor::coordFrame() is
LOCAL or WORLD, respectively.
The virtual sphere’s radius is determined by the distance between the center and the
initial point of intersection.
Offsetting the Rotation
You can offset the rotation of the virtual sphere using the following method:
csSphereSensor::setOffset(csRotation offset);
This method adds offset to the rotation value derived from the motion of the pointer
device.
setAutoOffet() sets the value of offset in setOffset() to the value of the rotation when the
csSphereSensor is deactivated.
To enable autoOffset, call the following method with an argument that evaluates TRUE:
csSphereSensor::setAutoOffet(csBool autoOffset);
In the case where a csSphereSensor is used to rotate its associated geometry, setting
autoOffset to TRUE keeps the geometry from snapping back to its original orientation
when the csSphereSensor is activated a second time.