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

X3D Example Archives: Conformance Nist, Sensors, Plane Sensor

X3D Scenes Descriptions
autooffset Two Box geometry each have a PlaneSensor associated with them. The PlaneSensor for each Box has an offset value that translates the Box geometry -1 1 0 (for the left Box) and 1 1 0 (for the right Box) direction when that geometry is initially selected. The left PlaneSensor, associated with the blue box has its autoOffset value set to false. The right PlaneSensor, associated with the green Box has its autoOffset field set to true. The result is,both boxes should translate to their initial offset when indicated. After that, the blue box should return to that position each time it is selected. The green box should NOT return to that position each time it is selected.
default Test if PlaneSensor works for default field values. A PlaneSensor is associated with a red Box geometry. When pressing left mouse button over the red box and dragging, the Box should translate in the X and Y direction by the same amount as the indicating pointing device moves in the XY plane intersected by the bearing line of the pointing device. Movement should not be restricted or "clamped" in the X or Y direction. The Box should not "snap back" to its original position each time it is indicated by the pointing device.
enabled Test the action of PlaneSensors field enabled. The world includes a PlaneSensor which has enabled false and a red box. When pressing left mouse button over the red box and dragging, the box should not move.
isactive Test if a PlaneSensor generates an isActive field when indicated by a pointing device. A red Box geometry has a default PlaneSensor node associated with it. Pressing the primary pointing device button down while the pointing device is over the Box should generate an isActive field, and turn a PointLight on.
minmax A PlaneSensor is associated with a red Box geometry. With minPosition less than maxPosition in both X and Y, the red Box should is "clamped" in movement only within the enclosing rectangle when dragged by the pointing device.
minmax x Test the function of PlaneSensor if minPosition = maxPosition in its X component. A red Box geometry has an associated PlaneSensor with minPosition = 0 = maxPosition for X, and minPosition = -2 and maxPosition = 2 for Y. As a result, when pressing over the Box and dragging, the translation of the Box should be constrainted in movement so that it travels in a line only, between Y = -2 and Y = 2.
minmax y Test the function of PlaneSensor if minPosition = maxPosition in its Y component. A red Box geometry has an associated PlaneSensor with minPosition = 0 = maxPosition for Y, and minPosition = -2 and maxPosition = 2 for X. As a result, when pressing over the Box and dragging, the translation of the Box should be constrainted in movement so that it travels in a line only, between X = -2 and X = 2.
multisensor Test if a PlaneSensor grabs all further motion events from pointing device when the sensor generates "isActive" true event for primitive geometry. The Box geometry has an associated PlaneSensor that routes its "trackPoint_changed" events to that geometrys Transform node. As a result, pressing the primary pointing device button while over the Box should translate that geometry in an XY plane coincident with the intersection point of the pointing device bearing and the geometry surface. 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 PlaneSensor 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 Three Box geometry each have a PlaneSensor associated with them, and each has a different offset value associated with it. The result is, when the geometry is selected by the pointing device, the left Box should translate -1 -1 -2 in X,Y and Z respectively. The center Box has offsets of 0 0 0 each time, and the right Box should translate by 1 1 2 in X,Y and Z. Subsequent indications of the same geometry with the pointing device should cause the Box geometry to reset to its this offset position first before it can be dragged.
offset changed Test of the offset_changed field. A PlaneSensor is associated with a red Box geometry. Its "offset_changed" field is routed to the translation field of the "axis" geometrys (an IndexedLineSet) Transform node. The result is, since autoOffset is set to true; as the Box geometry device is "dragged" along the virtual PlaneSensor, the "axis" geometry will follow it.
trackpoint changed Test of the trackPoint_changed field. A Box geometry has an associated PlaneSensor, which, when the Box is indicated by the pointing device, should route its trackPoint_changed event to the Transform of a red Sphere geometry. The result is, the the primary pointing device button is pressed while over the Box, a red Sphere should appear at the same point on the geometry, and follow the pointing device as it moves along the invisible XY plane.
translation changed Test of the translation_changed field. A Box geometry has an associated PlaneSensor, which, when the Box is indicated by the pointing device, should route its translation_changed event to the Transform of a red Sphere geometry. The translation_changed value should equal the relative change in position between the current pointing device intersection point with the PlaneSensor and the previous position, PLUS the offset value (in this case a value of 0 0 1). The result is, the the primary pointing device button is pressed while over the Box, a red Sphere should appear initially on the Box, and move an equal distance in both X and Y as the pointing device, as it is dragged along the invisible XY plane. Since the Sphere is offset from pointing device, it will not be coincident with the pointing device bearing, but WILL move in the exact same relative direction.
unclamped A PlaneSensor is associated with a red Box geometry. With minPosition greater than maxPosition in both X and Y, the red Box should be able to move freely beyond the enclosing rectangle when dragged by the pointing device.
unison Test if a PlaneSensor works in "unison" with a "sibling" TouchSensor associated with the same Box geometry. The Box geometry has an associated PlaneSensor that routes its "trackPoint_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 translate that geometry in an XY plane, coincident with the intersection point of the pointing device bearing and the geometry surface, while the PointLight remains on. 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/PlaneSensor

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/PlaneSensor

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.