hmi.animation
Class VJointMoveControl

java.lang.Object
  extended by hmi.animation.VJointMoveControl
All Implemented Interfaces:
ClockListener

public class VJointMoveControl
extends Object
implements ClockListener

This class uses keyboard input to move an object around. The keyboard input is taken from a keystate determined by a certain Component. Keys: A and D move left and right, W and S move back and forth, Left and right "arrow" keys rotate, Up and down "arrow" keys move back and forth. PageUp and PageDown move up and down. This object is initialized with the VJoint it is supposed to move around. Also, at init time you say whether the keys should be inverted -- this makes the VJointMoveControl usable as a navigationcontrol (moving the scene in inverted way means moving the person view in normal way...) One can pass required keymodifiers KeyEvent.VK_CONTROL/VK_ALT/VK_SHIFT at construction time The control should be connected to a clock -- every clock tick, the controlled VJoint is updated


Field Summary
(package private)  float angVel
           
private  boolean bListening
           
private static float conv
           
(package private)  double currentDoubleTime
           
static double degToRad
           
private  float inversionFactor
           
private  KeyState keyState
           
(package private)  double lastTime
           
(package private)  float linVel
           
private  float maxX
           
private  float maxY
           
private  float maxZ
           
private  float minX
           
private  float minY
           
private  float minZ
           
(package private)  float[] orientation
           
(package private)  float[] position
           
private  float[] rotation
           
private  float[] rotationMatrix
           
(package private)  float strafeVel
           
private  List<Integer> theKeyModifiers
           
private  VJoint theVJoint
           
private  float[] transformMatrix
           
private  float[] translation
           
private  float[] translationMatrix
           
private  boolean useLimits
           
(package private)  float vertVel
           
 
Constructor Summary
VJointMoveControl(Component c, VJoint joint, boolean invert, int[] keyModifiers)
          Creates a new VJointMoveControl, listening to Component c for key and mouse events and controlling object 'joint'
VJointMoveControl(Component c, VJoint joint, boolean invert, int[] keyModifiers, float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
          Creates a new VJointMoveControl, listening to Component c for key and mouse events and controlling object 'joint', and given limits
 
Method Summary
protected  void applyLimits()
           
private  boolean correctModifiers(KeyState keyState)
          Returns true if the keystate contains exactly those modifiers with which this control was initialized
 void initTime(double time)
          initTime() is called before the Clock starts running, and sends some initial time value.
 void setLimits(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
           
 void setListening(boolean l)
           
 void setOrientation(float xrot, float yrot, float zrot)
          set the three Euler angles
 void setPosition(float[] pos)
          set the position vector
 void setPosition(float x, float y, float z)
          set the position vector
 void setRollPitchYaw(float roll, float pitch, float yaw)
           
 void setTranslation(float tx, float ty, float tz)
           
 void setVJoint(VJoint newVJoint)
           
 void time(double currentTime)
          Every clock tick, - check the new movements from the keystate, depending on the pressed keys - update the position and orientation of the controlled object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theVJoint

private VJoint theVJoint

keyState

private KeyState keyState

inversionFactor

private float inversionFactor

theKeyModifiers

private List<Integer> theKeyModifiers

bListening

private boolean bListening

useLimits

private boolean useLimits

minX

private float minX

minY

private float minY

minZ

private float minZ

maxX

private float maxX

maxY

private float maxY

maxZ

private float maxZ

currentDoubleTime

double currentDoubleTime

lastTime

double lastTime

position

float[] position

orientation

float[] orientation

rotation

private float[] rotation

translation

private float[] translation

transformMatrix

private float[] transformMatrix

rotationMatrix

private float[] rotationMatrix

translationMatrix

private float[] translationMatrix

linVel

float linVel

vertVel

float vertVel

strafeVel

float strafeVel

angVel

float angVel

degToRad

public static final double degToRad
See Also:
Constant Field Values

conv

private static final float conv
See Also:
Constant Field Values
Constructor Detail

VJointMoveControl

public VJointMoveControl(Component c,
                         VJoint joint,
                         boolean invert,
                         int[] keyModifiers,
                         float minX,
                         float minY,
                         float minZ,
                         float maxX,
                         float maxY,
                         float maxZ)
Creates a new VJointMoveControl, listening to Component c for key and mouse events and controlling object 'joint', and given limits


VJointMoveControl

public VJointMoveControl(Component c,
                         VJoint joint,
                         boolean invert,
                         int[] keyModifiers)
Creates a new VJointMoveControl, listening to Component c for key and mouse events and controlling object 'joint'

Method Detail

setLimits

public void setLimits(float minX,
                      float minY,
                      float minZ,
                      float maxX,
                      float maxY,
                      float maxZ)

setVJoint

public void setVJoint(VJoint newVJoint)

setPosition

public void setPosition(float[] pos)
set the position vector


setPosition

public void setPosition(float x,
                        float y,
                        float z)
set the position vector


setOrientation

public void setOrientation(float xrot,
                           float yrot,
                           float zrot)
set the three Euler angles


setRollPitchYaw

public void setRollPitchYaw(float roll,
                            float pitch,
                            float yaw)

setTranslation

public void setTranslation(float tx,
                           float ty,
                           float tz)

setListening

public void setListening(boolean l)

applyLimits

protected void applyLimits()

correctModifiers

private boolean correctModifiers(KeyState keyState)
Returns true if the keystate contains exactly those modifiers with which this control was initialized


initTime

public void initTime(double time)
Description copied from interface: ClockListener
initTime() is called before the Clock starts running, and sends some initial time value. This will often equal the time send for the first regular time() call. This is done on the same clock Thread that is going to send the regular time() calls.

Specified by:
initTime in interface ClockListener

time

public void time(double currentTime)
Every clock tick, - check the new movements from the keystate, depending on the pressed keys - update the position and orientation of the controlled object

Specified by:
time in interface ClockListener