com.sun.electric.plugins.j3d
Class J3DKeyBehavior

java.lang.Object
  extended by Behavior
      extended by com.sun.electric.plugins.j3d.J3DKeyBehavior
Direct Known Subclasses:
J3DKeyCollision

public class J3DKeyBehavior
extends Behavior

Inspired in example found in Daniel Selman's book "Java 3D Programming" For more information about the original example, contact Daniel Selman: daniel@selman.org Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Version:
0.1
Author:
Gilda Garreton

Field Summary
protected static double FAST_SPEED
           
protected  WakeupCondition keyCriterion
           
protected static double NORMAL_SPEED
           
protected  TransformGroup tGroup
           
protected  Transform3D transform
           
 
Constructor Summary
J3DKeyBehavior(TransformGroup tg)
           
 
Method Summary
protected  void altMove(int keycode)
           
protected  void controlMove(int keycode)
           
protected  double getMovementRate()
           
 void initialize()
           
 void moveAlongAxis(int axis, int dir)
          Method to shift along axis in direction provided
protected  void processKeyEvent(java.awt.event.KeyEvent event)
           
 void processStimulus(java.util.Enumeration criteria)
           
protected  boolean rotate(int axis, double radians, boolean force)
          Method that rotates along given axis
protected  void rotateAlongAxis(int axis, int dir)
          Method to rotate along given axis and direction provided
 void setHomeRotation(double[] rotVals)
          Method to set the original rotation
protected  boolean updateTransform(boolean force)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FAST_SPEED

protected static final double FAST_SPEED
See Also:
Constant Field Values

NORMAL_SPEED

protected static final double NORMAL_SPEED
See Also:
Constant Field Values

tGroup

protected TransformGroup tGroup

transform

protected Transform3D transform

keyCriterion

protected WakeupCondition keyCriterion
Constructor Detail

J3DKeyBehavior

public J3DKeyBehavior(TransformGroup tg)
Method Detail

initialize

public void initialize()

processStimulus

public void processStimulus(java.util.Enumeration criteria)

processKeyEvent

protected void processKeyEvent(java.awt.event.KeyEvent event)

altMove

protected void altMove(int keycode)

controlMove

protected void controlMove(int keycode)

moveAlongAxis

public void moveAlongAxis(int axis,
                          int dir)
Method to shift along axis in direction provided

Parameters:
axis -
dir -

rotateAlongAxis

protected void rotateAlongAxis(int axis,
                               int dir)
Method to rotate along given axis and direction provided

Parameters:
axis -
dir -

updateTransform

protected boolean updateTransform(boolean force)

setHomeRotation

public void setHomeRotation(double[] rotVals)
Method to set the original rotation

Parameters:
rotVals -

rotate

protected boolean rotate(int axis,
                         double radians,
                         boolean force)
Method that rotates along given axis

Parameters:
axis -
radians -
Returns:
True if there was no collision

getMovementRate

protected double getMovementRate()