com.jme.input.action
Class MouseLook

java.lang.Object
  extended bycom.jme.input.action.MouseLook
All Implemented Interfaces:
InputAction, MouseInputAction

public class MouseLook
extends java.lang.Object
implements MouseInputAction

MouseLook defines a mouse action that detects mouse movement and converts it into camera rotations and camera tilts.

Version:
$Id: MouseLook.java,v 1.10 2004/10/14 01:23:02 mojomonkey Exp $
Author:
Mark Powell

Constructor Summary
MouseLook(Mouse mouse, Camera camera, float speed)
          Constructor creates a new MouseLook object.
 
Method Summary
 java.lang.String getKey()
           
 Vector3f getLockAxis()
          Returns the axis that is currently locked.
 float getSpeed()
          getSpeed retrieves the speed of the mouse look.
 void performAction(InputActionEvent evt)
          performAction checks for any movement of the mouse, and calls the appropriate method to alter the camera's orientation when applicable.
 void setKey(java.lang.String key)
           
 void setLockAxis(Vector3f lockAxis)
          setLockAxis sets the axis that should be locked down.
 void setMouse(Mouse mouse)
          setMouse sets the mouse used to check for movement.
 void setSpeed(float speed)
          setSpeed sets the speed of the mouse look.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MouseLook

public MouseLook(Mouse mouse,
                 Camera camera,
                 float speed)
Constructor creates a new MouseLook object. It takes the mouse, camera and speed of the looking.

Parameters:
mouse - the mouse to calculate view changes.
camera - the camera to move.
speed - the speed at which to alter the camera.
Method Detail

setLockAxis

public void setLockAxis(Vector3f lockAxis)
setLockAxis sets the axis that should be locked down. This prevents "rolling" about a particular axis. Typically, this is set to the mouse's up vector. Note this is only a shallow copy.

Parameters:
lockAxis - the axis that should be locked down to prevent rolling.

getLockAxis

public Vector3f getLockAxis()
Returns the axis that is currently locked.

Returns:
The currently locked axis
See Also:
setLockAxis(com.jme.math.Vector3f)

setSpeed

public void setSpeed(float speed)
setSpeed sets the speed of the mouse look.

Specified by:
setSpeed in interface InputAction
Parameters:
speed - the speed of the mouse look.

getSpeed

public float getSpeed()
getSpeed retrieves the speed of the mouse look.

Specified by:
getSpeed in interface InputAction
Returns:
the speed of the mouse look.

performAction

public void performAction(InputActionEvent evt)
performAction checks for any movement of the mouse, and calls the appropriate method to alter the camera's orientation when applicable.

Specified by:
performAction in interface InputAction
Parameters:
evt - the event that triggered the perform action method.
See Also:
InputAction.performAction(InputActionEvent)

setMouse

public void setMouse(Mouse mouse)
setMouse sets the mouse used to check for movement.

Specified by:
setMouse in interface MouseInputAction
Parameters:
mouse - the mouse used by this mouse.
See Also:
MouseInputAction.setMouse(com.jme.input.Mouse)

setKey

public void setKey(java.lang.String key)
Specified by:
setKey in interface InputAction

getKey

public java.lang.String getKey()
Specified by:
getKey in interface InputAction