com.sun.j3d.utils.behaviors.sensor
Class Mouse6DPointerBehavior

java.lang.Object
  extended by javax.media.j3d.SceneGraphObject
      extended by javax.media.j3d.Node
          extended by javax.media.j3d.Leaf
              extended by javax.media.j3d.Behavior
                  extended by com.sun.j3d.utils.behaviors.sensor.Mouse6DPointerBehavior

public class Mouse6DPointerBehavior
extends Behavior

This class provides basic behavior for a 6DOF mouse sensor. It generates a visible 3D cursor echo in the virtual world which tracks the position and orientation of the 6DOF mouse in the physical world. It can be extended to provide other functions by accessing its SensorEventAgent.

Since:
Java 3D 1.3
See Also:
SensorEventAgent

Nested Class Summary
 class Mouse6DPointerBehavior.EchoReadListener
          This member class updates the echo transform in response to sensor reads.
 
Field Summary
 
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
Mouse6DPointerBehavior(Sensor sensor, double size, boolean enableLighting)
          Constructs the behavior with a default echo.
Mouse6DPointerBehavior(Sensor sensor, TransformGroup tg)
          Constructs the behavior with an echo parented by the specified TransformGroup.
 
Method Summary
 TransformGroup getEcho()
          Gets the echo used by this behavior.
 Sensor getSensor()
          Gets the sensor used by this behavior.
 SensorEventAgent getSensorEventAgent()
          Gets the SensorEventAgent used by this behavior.
 void initialize()
          Initializes the behavior.
 void processStimulus(java.util.Enumeration criteria)
          Processes a stimulus meant for this behavior.
 
Methods inherited from class javax.media.j3d.Behavior
getEnable, getNumSchedulingIntervals, getSchedulingBoundingLeaf, getSchedulingBounds, getSchedulingInterval, getView, getWakeupCondition, postId, setEnable, setSchedulingBoundingLeaf, setSchedulingBounds, setSchedulingInterval, updateNodeReferences, wakeupOn
 
Methods inherited from class javax.media.j3d.Node
cloneNode, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Mouse6DPointerBehavior

public Mouse6DPointerBehavior(Sensor sensor,
                              double size,
                              boolean enableLighting)
Constructs the behavior with a default echo. To make the echo visible, call getEcho() to retrieve the TransformGroup that parents the echo geometry, and then add that TransformGroup to the scene graph.

The default echo is a solid 6-pointed star where each point is aligned with the axes of the local coordinate system of the sensor, and with the center of the star at the location of the sensor hotspot.

Parameters:
sensor - a 6 degree of freedom Sensor which generates position and orientation relative to the tracker base.
size - the physical width of the echo in centimeters.
enableLighting - a boolean indicating whether the echo geometry should have lighting enabled.

Mouse6DPointerBehavior

public Mouse6DPointerBehavior(Sensor sensor,
                              TransformGroup tg)
Constructs the behavior with an echo parented by the specified TransformGroup.

Parameters:
sensor - a 6 degree of freedom Sensor which generates position and orientation relative to the tracker base.
tg - a TransformGroup with a child defining the visible echo which will track the Sensor position and orientation; the Transform3D associated with the TransformGroup will be updated in order to effect the behavior, so it must have the ALLOW_TRANSFORM_WRITE capability set before the scene graph is set live
Method Detail

getSensor

public Sensor getSensor()
Gets the sensor used by this behavior.

Returns:
the sensor used by this behavior

getEcho

public TransformGroup getEcho()
Gets the echo used by this behavior.

Returns:
the TransformGroup parenting this behavior's echo geometry

getSensorEventAgent

public SensorEventAgent getSensorEventAgent()
Gets the SensorEventAgent used by this behavior. This can be used to add customized event bindings to this behavior.

Returns:
the SensorEventAgent

initialize

public void initialize()
Initializes the behavior. NOTE: Applications should not call this method. It is called by the Java 3D behavior scheduler.

Specified by:
initialize in class Behavior

processStimulus

public void processStimulus(java.util.Enumeration criteria)
Processes a stimulus meant for this behavior. NOTE: Applications should not call this method. It is called by the Java 3D behavior scheduler.

Specified by:
processStimulus in class Behavior
Parameters:
criteria - an enumeration of triggered wakeup criteria for this behavior


Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.