Class PlayerKeyNavigator

java.lang.Object
  |
  +--KeyNavigatorEx
        |
        +--PlayerKeyNavigator

public class PlayerKeyNavigator
extends KeyNavigatorEx

This is the KeyNavigator class. It accumulates AWT key events (key press and key release) and computes a new transform based on the accumulated events and elapsed time. The most code of the integrateTransformChanges method was taken from the KeyNavigator class provided by Sun.


Field Summary
protected  boolean m_bActive
           
protected  boolean m_bCollision
           
protected  boolean m_bTurn
           
protected  CollisionHandler m_cCollisionHandler
           
protected  LocationHandler m_cLocationHandler
           
protected  Player m_cPlayer
           
 
Fields inherited from class KeyNavigatorEx
a, ALT, bwdAcc, bwdDrag, bwdVMax, DOWN_ARROW, downAcc, downDrag, downRotAngle, downVMax, dp, dv, fwdAcc, fwdDrag, fwdVMax, HOME_DIR, HOME_NOMINAL, KEY_DOWN, key_state, KEY_UP, LEFT_ARROW, leftAcc, leftDrag, leftRotAngle, leftVMax, lrQuat, m_Backward, m_Equals, m_Forward, m_Left, m_Minus, m_Plus, m_Right, m_ViewDown, m_ViewUp, mat, META, MINUS_SIGN, mmx, modifier_key_state, navVec, nda, nominal, PAGE_DOWN, PAGE_UP, PLUS_SIGN, RIGHT_ARROW, rightAcc, rightDrag, rightRotAngle, rightVMax, SHIFT, targetTG, temp, time, udQuat, UP_ARROW, upAcc, upDrag, upRotAngle, upVMax, vpMatrix, vpPos, vpQuat, vpScale, vpTrans
 
Constructor Summary
PlayerKeyNavigator(Player cPlayer, javax.media.j3d.TransformGroup targetTG)
          Constructs a new key navigator object that operates on the specified transform group.
 
Method Summary
 void integrateTransformChanges()
          Computes a new transform for the next frame based on the current transform, accumulated keyboard inputs, and elapsed time.
 void processKeyEvent(java.awt.event.KeyEvent keyEvent)
          Processed a keyboard event.
 
Methods inherited from class KeyNavigatorEx
accKeyAdd, genRotQuat, getDeltaTime, resetVelocity, setBackwardKey, setEqualKey, setForwardKey, setLeftKey, setMinusKey, setPlusKey, setRightKey, setViewDownKey, setViewUpKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_bTurn

protected boolean m_bTurn

m_bCollision

protected boolean m_bCollision

m_bActive

protected boolean m_bActive

m_cLocationHandler

protected LocationHandler m_cLocationHandler

m_cCollisionHandler

protected CollisionHandler m_cCollisionHandler

m_cPlayer

protected Player m_cPlayer
Constructor Detail

PlayerKeyNavigator

public PlayerKeyNavigator(Player cPlayer,
                          javax.media.j3d.TransformGroup targetTG)
Constructs a new key navigator object that operates on the specified transform group. All parameters are set to their default, idle state.
Parameters:
targetTG - the target transform group
Method Detail

integrateTransformChanges

public void integrateTransformChanges()
Computes a new transform for the next frame based on the current transform, accumulated keyboard inputs, and elapsed time. This new transform is written into the target transform group. This method should be called once per frame.
Overrides:
integrateTransformChanges in class KeyNavigatorEx

processKeyEvent

public void processKeyEvent(java.awt.event.KeyEvent keyEvent)
Processed a keyboard event. This routine should be called every time a KEY_PRESSED or KEY_RELEASED event is received.
Parameters:
keyEvent - the AWT key event
Overrides:
processKeyEvent in class KeyNavigatorEx