Class FirstPersonControl

java.lang.Object
com.ardor3d.input.control.FirstPersonControl

public class FirstPersonControl extends Object
  • Field Details

    • _upAxis

      protected final Vector3 _upAxis
    • _mouseRotateSpeed

      protected double _mouseRotateSpeed
    • _moveSpeed

      protected double _moveSpeed
    • _keyRotateSpeed

      protected double _keyRotateSpeed
    • _workerMatrix

      protected final Matrix3 _workerMatrix
    • _workerStoreA

      protected final Vector3 _workerStoreA
    • _mouseTrigger

      protected InputTrigger _mouseTrigger
    • _keyTrigger

      protected InputTrigger _keyTrigger
    • _clampVerticalAngle

      protected boolean _clampVerticalAngle
    • _minVerticalAngle

      protected double _minVerticalAngle
    • _maxVerticalAngle

      protected double _maxVerticalAngle
  • Constructor Details

  • Method Details

    • getUpAxis

      public ReadOnlyVector3 getUpAxis()
    • setUpAxis

      public void setUpAxis(ReadOnlyVector3 upAxis)
    • getMouseRotateSpeed

      public double getMouseRotateSpeed()
    • setMouseRotateSpeed

      public void setMouseRotateSpeed(double speed)
    • getMoveSpeed

      public double getMoveSpeed()
    • setMoveSpeed

      public void setMoveSpeed(double speed)
    • getKeyRotateSpeed

      public double getKeyRotateSpeed()
    • setKeyRotateSpeed

      public void setKeyRotateSpeed(double speed)
    • move

      protected void move(Camera camera, KeyboardState kb, double tpf)
    • rotate

      protected void rotate(Camera camera, double dx, double dy)
    • setupTriggers

      public static FirstPersonControl setupTriggers(LogicalLayer layer, ReadOnlyVector3 upAxis, boolean dragOnly)
      Parameters:
      layer - the logical layer to register with
      upAxis - the up axis of the camera
      dragOnly - if true, mouse input will only rotate the camera if one of the mouse buttons (left, center or right) is down.
      Returns:
      a new FirstPersonControl object
    • removeTriggers

      public static void removeTriggers(LogicalLayer layer, FirstPersonControl control)
      Unregister the triggers of the given FirstPersonControl from the given LogicalLayer.
      Parameters:
      layer - the logical layer
      control - the first person control
    • setupMouseTriggers

      public void setupMouseTriggers(LogicalLayer layer, boolean dragOnly)
    • setupKeyboardTriggers

      public Predicate<TwoInputStates> setupKeyboardTriggers(LogicalLayer layer)
    • getKeyTrigger

      public InputTrigger getKeyTrigger()
    • getMouseTrigger

      public InputTrigger getMouseTrigger()
    • isClampVerticalAngle

      public boolean isClampVerticalAngle()
    • setClampVerticalAngle

      public void setClampVerticalAngle(boolean clampVerticalAngle)
      Parameters:
      clampVerticalAngle - if true, the vertical angle of the camera is locked between the minimum and maximum angles (default is [-60, 60])
    • getMinVerticalAngle

      public double getMinVerticalAngle()
    • setMinVerticalAngle

      public void setMinVerticalAngle(double minVerticalAngle)
      Parameters:
      minVerticalAngle - the new minimum angle, in radians, to clamp our vertical angle to. Defaults to -60 degrees (in radians). Must be less than the max angle. Has no effect unless clampVerticalAngle is true.
      See Also:
    • getMaxVerticalAngle

      public double getMaxVerticalAngle()
    • setMaxVerticalAngle

      public void setMaxVerticalAngle(double maxVerticalAngle)
      Parameters:
      maxVerticalAngle - the new maximum angle, in radians, to clamp our vertical angle to. Defaults to +60 degrees (in radians). Must be less than the max angle. Has no effect unless clampVerticalAngle is true.
      See Also: