Table of Contents Previous Chapter Details Viewpoint Slideshow Next Chapter Details X3D Resources

X3D Example Archives: Conformance Nist, Sensors, Sphere Sensor

X3D Scenes Descriptions
default A default SphereSensor is assigned to an IndexedFaceSet geometry. The rotation_changed fields from the SphereSensor are routed to the transform node for the same geometry. As a result, moving the geometry should result in, when moved in any direction, a "spherelike" rotation. The geometry should keep its orientation after each "drag" motion of the pointing device.
enabled Test the function of SphereSensors field "enabled". An IndexedFaceSet geometry has an associated SphereSensor node, with the "enabled" field set to false, and its rotation_changed field routed to the geometrys Transform node. As a result, despite the routing of the rotation_changed event from the SphereSensor node, the geometry should not rotate when the pointing device is "dragged" over the geometry.
isactive Test if the SphereSensor node isActive field can be routed to other node. A Box geometry has an associated SphereSensor, which routes its isActive event to an associated PointLight. When the primary pointing device buttons is depressed while over a geometry, the associated PointLight will turn on. Letting up on the pointing device button should turn the light off.
multisensor Test if a SphereSensor grabs all further motion events from pointing device when the sensor generates "isActive" true event for primitive geometry. The Box geometry has an associated SphereSensor that routes its "rotation_changed" events to that geometrys Transform node. As a result, pressing the primary pointing device button while over the Box should rotate that geometry. In addition, a TouchSensor is assocated with the Box geometry and a PointLight, but is nested "higher" in the sensor hierarchy. Passing the primary pointing device over the Box should route and isActive event to a PointLight and illuminate the IndexedFaceSets. Dragging the pointing device over the Box geometry and holding the primary pointing device button down should generate an isActive = true event for the SphereSensor and prevent the TouchSensor from activating (and the PointLight from coming ON), When the button is released, and the cursor is over the Box, the PointLight should turn on.
offset Test the function of SphereSensors offset field. The world includes 3 SphereSensors, each associated with its own Box geometry. Each box has a red X, green Y, and blue Z axis. The left Box geometry has an offset value of -90 degrees X rotation. The center Box has an offset of +90 degrees Y rotation. The right Box has an offset of -90 degrees Z rotation. When the left Box geometry is selected by the pointing device (by holding down the primary pointing device button while indicating the geometry), it should "snap" to its offset position, and the red line should extend from the right face of the box, along the X axis, the green line should extend from the rear face, along the Z axis, and the blue line should extend vertically from the top face, along to the Z axis. Indicating the central Box should result in: the red line should extend from the rear face of the Box, along the Z axis, the green line should extend from the top face of the box, along the Y axis, and the blue line should extend from the right face of the box, along the X axis. Indicating the the right Box should result in: the red line should extend from the bottom face, along the Y axis, the green line should extend from the right face, along the X axis, and the blue line should extend from the front face, along the Z axis. All geometry should "snap" to its original offset position each time it is selected.
offsetfalse Test the function of SphereSensors offset field when autoOffset is false. The world includes a SphereSensor associated with its own Box geometry. The Box has a red X, green Y, and blue Z axis. The Box has a default offset of 0 degrees. Indicating the Box with the pointing device should result in: the red line should extend from the right face of the Box, along the X axis, the green line should extend from the top face of the box, along the Y axis, and the blue line should extend from the front face of the box, along the Z axis. All subsequent drags of the Box should "snap" the Box back to this orientation at the beginning of each drag.
offsettrue Test the function of SphereSensors offset field when autoOffset is true. The world includes a SphereSensor associated with its own Box geometry. The Box has a red X, green Y, and blue Z axis. The Box has a default offset of 0 degrees. Indicating the Box with the pointing device should result in: the red line should extend from the right face of the Box, along the X axis, the green line should extend from the top face of the box, along the Y axis, and the blue line should extend from the front face of the box, along the Z axis. All subsequent drags of the Box should NOT "snap" the geometry back to its original orienatation, but should simply continue to drag from the current geometry orientation.
trackpoint changed Test the SphereSensors node ability to send "trackPoint_changed" events to other node. A SphereSensor is associated with a Sphere geometry. In addition, a red Sphere receives the "trackPoint_changed" event as the pointing device is dragged over the geometry. The result is, the red Sphere follows the pointing device while it is over the geometry an the primary button is depressed. The motion will follow the invisible Sphere whose axis is the Y axis, and whose radius is the distance from the Y axis and the intersection of the pointer bearing and the geometry. As a result, the ball will appear to follow the Sphere surface as the cursor is dragged over the geometry. trackPoint_changed events are undefined when the pointing device is dragged outside the bounds of the geometry.
unison Test if a SphereSensor works in "unison" with a "sibling" TouchSensor associated with the same Box geometry. The Box geometry has an associated SphereSensor that routes its "rotation_changed" events to that geometrys Transform node. In addition, a TouchSensor is also a child of the same Transform node. As a result, passing the primary pointing device over the Box should turn on a PointLight. Pressing the primary pointing device button while over the Box and "dragging" should rotate that geometry, while the PointLight remains on. When the cursor is released, the Box should stop rotating. When the pointing device is no longer over the Box, the PointLight should turn off.

Online at http://www.web3d.org/x3d/content/examples/ConformanceNist/Sensors/SphereSensor

Master source code archive is under subversion control at
http://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/ConformanceNist/Sensors/SphereSensor

Table of Contents Previous Chapter Details Viewpoint Slideshow Next Chapter Details X3D Resources

Also available: current and archived nightly builds and distributions of these examples, all published under an Open-Source License.

The X3D Resources: Examples page and Savage Developers Guide provide more information about the production of this archive.