com.jme.input.thirdperson
Class ThirdPersonMouseLook
java.lang.Object
com.jme.input.action.InputAction
com.jme.input.action.MouseInputAction
com.jme.input.thirdperson.ThirdPersonMouseLook
- All Implemented Interfaces:
- InputActionInterface
public class ThirdPersonMouseLook
- extends MouseInputAction
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PROP_MAXASCENT
public static final java.lang.String PROP_MAXASCENT
- See Also:
- Constant Field Values
PROP_MINASCENT
public static final java.lang.String PROP_MINASCENT
- See Also:
- Constant Field Values
PROP_MAXROLLOUT
public static final java.lang.String PROP_MAXROLLOUT
- See Also:
- Constant Field Values
PROP_MINROLLOUT
public static final java.lang.String PROP_MINROLLOUT
- See Also:
- Constant Field Values
PROP_MOUSEXMULT
public static final java.lang.String PROP_MOUSEXMULT
- See Also:
- Constant Field Values
PROP_MOUSEYMULT
public static final java.lang.String PROP_MOUSEYMULT
- See Also:
- Constant Field Values
PROP_MOUSEROLLMULT
public static final java.lang.String PROP_MOUSEROLLMULT
- See Also:
- Constant Field Values
PROP_INVERTEDY
public static final java.lang.String PROP_INVERTEDY
- See Also:
- Constant Field Values
PROP_LOCKASCENT
public static final java.lang.String PROP_LOCKASCENT
- See Also:
- Constant Field Values
PROP_ROTATETARGET
public static final java.lang.String PROP_ROTATETARGET
- See Also:
- Constant Field Values
PROP_ENABLED
public static final java.lang.String PROP_ENABLED
- See Also:
- Constant Field Values
PROP_TARGETTURNSPEED
public static final java.lang.String PROP_TARGETTURNSPEED
- See Also:
- Constant Field Values
PROP_MOUSEBUTTON_FOR_LOOKING
public static final java.lang.String PROP_MOUSEBUTTON_FOR_LOOKING
- See Also:
- Constant Field Values
PROP_INVERTROTATE
public static final java.lang.String PROP_INVERTROTATE
- See Also:
- Constant Field Values
DEFAULT_MOUSEXMULT
public static final float DEFAULT_MOUSEXMULT
- See Also:
- Constant Field Values
DEFAULT_MOUSEYMULT
public static final float DEFAULT_MOUSEYMULT
- See Also:
- Constant Field Values
DEFAULT_MOUSEROLLMULT
public static final float DEFAULT_MOUSEROLLMULT
- See Also:
- Constant Field Values
DEFAULT_MAXASCENT
public static final float DEFAULT_MAXASCENT
- See Also:
- Constant Field Values
DEFAULT_MINASCENT
public static final float DEFAULT_MINASCENT
- See Also:
- Constant Field Values
DEFAULT_MAXROLLOUT
public static final float DEFAULT_MAXROLLOUT
- See Also:
- Constant Field Values
DEFAULT_MINROLLOUT
public static final float DEFAULT_MINROLLOUT
- See Also:
- Constant Field Values
DEFAULT_TARGETTURNSPEED
public static final float DEFAULT_TARGETTURNSPEED
- See Also:
- Constant Field Values
DEFAULT_INVERTEDY
public static final boolean DEFAULT_INVERTEDY
- See Also:
- Constant Field Values
DEFAULT_LOCKASCENT
public static final boolean DEFAULT_LOCKASCENT
- See Also:
- Constant Field Values
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLED
- See Also:
- Constant Field Values
DEFAULT_ROTATETARGET
public static final boolean DEFAULT_ROTATETARGET
- See Also:
- Constant Field Values
DEFAULT_INVERTROTATE
public static final boolean DEFAULT_INVERTROTATE
- See Also:
- Constant Field Values
DEFAULT_MOUSEBUTTON_FOR_LOOKING
public static final int DEFAULT_MOUSEBUTTON_FOR_LOOKING
- See Also:
- Constant Field Values
maxAscent
protected float maxAscent
minAscent
protected float minAscent
maxRollOut
protected float maxRollOut
minRollOut
protected float minRollOut
mouseXMultiplier
protected float mouseXMultiplier
mouseYMultiplier
protected float mouseYMultiplier
mouseRollMultiplier
protected float mouseRollMultiplier
mouseXSpeed
protected float mouseXSpeed
mouseYSpeed
protected float mouseYSpeed
rollInSpeed
protected float rollInSpeed
targetTurnSpeed
protected float targetTurnSpeed
camera
protected ChaseCamera camera
target
protected Spatial target
updated
protected boolean updated
invertedY
protected boolean invertedY
lockAscent
protected boolean lockAscent
enabled
protected boolean enabled
rotateTarget
protected boolean rotateTarget
invertRotate
protected boolean invertRotate
lookMouse
protected int lookMouse
difTemp
protected Vector3f difTemp
sphereTemp
protected Vector3f sphereTemp
rightTemp
protected Vector3f rightTemp
rotTemp
protected Quaternion rotTemp
worldUpVec
protected Vector3f worldUpVec
plugin
protected ThirdPersonJoystickPlugin plugin
ThirdPersonMouseLook
public ThirdPersonMouseLook(RelativeMouse mouse,
ChaseCamera camera,
Spatial target)
- 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.
updateProperties
public void updateProperties(java.util.Map<java.lang.String,java.lang.Object> props)
updateProperties
- Parameters:
props
-
setSpeed
public void setSpeed(float speed)
setSpeed
sets the speed of the mouse look.
- Overrides:
setSpeed
in class InputAction
- Parameters:
speed
- the speed of the mouse look.
performAction
public void performAction(InputActionEvent event)
performAction
checks for any movement of the mouse, and
calls the appropriate method to alter the camera's orientation when
applicable.
- Parameters:
event
- the event that triggered the perform action method.- See Also:
InputActionInterface.performAction(InputActionEvent)
updateFromJoystick
protected void updateFromJoystick(float time)
setInvertedY
public void setInvertedY(boolean invertY)
- Parameters:
invertY
- true if mouse control should be inverted vertically
isInvertedY
public boolean isInvertedY()
- Returns whether vertical control is inverted (ie pulling down on the
mouse causes the camera to look up)
- Returns:
- true if vertical control is inverted (aircraft style)
getMaxAscent
public float getMaxAscent()
- Returns:
- Returns the maxAscent.
setMaxAscent
public void setMaxAscent(float maxAscent)
- Parameters:
maxAscent
- The maxAscent to set.
getMinAscent
public float getMinAscent()
- Returns:
- Returns the minAscent.
setMinAscent
public void setMinAscent(float minAscent)
- Parameters:
minAscent
- The minAscent to set.
getMaxRollOut
public float getMaxRollOut()
- Returns:
- Returns the maxRollOut.
setMaxRollOut
public void setMaxRollOut(float maxRollOut)
- Parameters:
maxRollOut
- The maxRollOut to set.
getMinRollOut
public float getMinRollOut()
- Returns:
- Returns the minRollOut.
setMinRollOut
public void setMinRollOut(float minRollOut)
- Parameters:
minRollOut
- The minRollOut to set.
getTargetTurnSpeed
public float getTargetTurnSpeed()
- Returns:
- how quickly to turn the target in radians per second - only
applicable if rotateTarget is true.
setTargetTurnSpeed
public void setTargetTurnSpeed(float speed)
- Parameters:
speed
- how quickly to turn the target in radians per second - only
applicable if rotateTarget is true.
getMouseXMultiplier
public float getMouseXMultiplier()
- Returns:
- Returns the mouseXMultiplier.
setMouseXMultiplier
public void setMouseXMultiplier(float mouseXMultiplier)
- Parameters:
mouseXMultiplier
- The mouseXMultiplier to set. Updates mouseXSpeed as well.
getMouseYMultiplier
public float getMouseYMultiplier()
- Returns:
- Returns the mouseYMultiplier.
setMouseYMultiplier
public void setMouseYMultiplier(float mouseYMultiplier)
- Parameters:
mouseYMultiplier
- The mouseYMultiplier to set. Updates mouseYSpeed as well.
getMouseRollMultiplier
public float getMouseRollMultiplier()
- Returns:
- Returns the mouseRollMultiplier.
setMouseRollMultiplier
public void setMouseRollMultiplier(float mouseRollMultiplier)
- Parameters:
mouseRollMultiplier
- The mouseRollMultiplier to set. Updates rollInSpeed as well.
setLockAscent
public void setLockAscent(boolean lock)
- Parameters:
lock
- true if camera's polar angle / ascent value should never
change.
isLockAscent
public boolean isLockAscent()
- Returns:
- true if camera's polar angle / ascent value should never change.
isEnabled
public boolean isEnabled()
- Returns:
- true if mouselook is enabled.
setEnabled
public void setEnabled(boolean enabled)
- Parameters:
enabled
- true to allow mouselook to affect camera.
isRotateTarget
public boolean isRotateTarget()
- Returns:
- true if turning mouse should cause the target to turn as well.
setRotateTarget
public void setRotateTarget(boolean rotateTarget)
- Parameters:
rotateTarget
- true if turning mouse should cause the target to turn as well.
getLookMouseButton
public int getLookMouseButton()
- Returns:
- the index of the button that must be pressed to activate looking
or -1 if no button is needed
setLookMouseButton
public void setLookMouseButton(int button)
- Sets the button to use for look actions. For example, if set to 0, the
left button must be held down to move the camera around.
- Parameters:
button
- index of required button or -1 (default) if none
setWorldUpVec
public void setWorldUpVec(Vector3f worldUpVec)
- Parameters:
worldUpVec
- The worldUpVec to set (as copy)
getJoystickPlugin
public ThirdPersonJoystickPlugin getJoystickPlugin()
- Returns:
- Returns the joystick plugin or null if not set.
setJoystickPlugin
public void setJoystickPlugin(ThirdPersonJoystickPlugin joystick)
- Parameters:
joystick
- The joystick plugin to set.
getChaseCamera
public ChaseCamera getChaseCamera()
setChaseCamera
public void setChaseCamera(ChaseCamera camera)
getTarget
public Spatial getTarget()
setTarget
public void setTarget(Spatial target)