Class DefaultJoystickAxis

java.lang.Object
com.jme3.input.DefaultJoystickAxis
All Implemented Interfaces:
JoystickAxis
Direct Known Subclasses:
AndroidSensorJoyInput.AndroidSensorJoystickAxis

public class DefaultJoystickAxis extends Object implements JoystickAxis
Default implementation of the JoystickAxis interface.
  • Constructor Details

    • DefaultJoystickAxis

      public DefaultJoystickAxis(InputManager inputManager, Joystick parent, int axisIndex, String name, String logicalId, boolean isAnalog, boolean isRelative, float deadZone)
      Creates a new joystick axis instance. Only used internally.
      Parameters:
      inputManager - (alias created)
      parent - (alias created)
      axisIndex - index for the new axis
      name - name for the new axis
      logicalId - logical identifier for the new axis
      isAnalog - true→continuous range, false→discrete values
      isRelative - true→presents relative values
      deadZone - the radius of the dead zone
  • Method Details

    • assignAxis

      public void assignAxis(String positiveMapping, String negativeMapping)
      Assign the mappings to receive events from the given joystick axis.
      Specified by:
      assignAxis in interface JoystickAxis
      Parameters:
      positiveMapping - The mapping to receive events when the axis is negative
      negativeMapping - The mapping to receive events when the axis is positive
    • getJoystick

      public Joystick getJoystick()
      Returns the joystick to which this axis object belongs.
      Specified by:
      getJoystick in interface JoystickAxis
      Returns:
      the pre-existing instance
    • getName

      public String getName()
      Returns the name of this joystick.
      Specified by:
      getName in interface JoystickAxis
      Returns:
      the name of this joystick.
    • getLogicalId

      public String getLogicalId()
      Returns the logical identifier of this joystick axis.
      Specified by:
      getLogicalId in interface JoystickAxis
      Returns:
      the logical identifier of this joystick.
    • getAxisId

      public int getAxisId()
      Returns the axisId of this joystick axis.
      Specified by:
      getAxisId in interface JoystickAxis
      Returns:
      the axisId of this joystick axis.
    • isAnalog

      public boolean isAnalog()
      Returns true if this is an analog axis, meaning the values are a continuous range instead of 1, 0, and -1.
      Specified by:
      isAnalog in interface JoystickAxis
      Returns:
      true if analog, otherwise false
    • isRelative

      public boolean isRelative()
      Returns true if this axis presents relative values.
      Specified by:
      isRelative in interface JoystickAxis
      Returns:
      true if relative, otherwise false
    • getDeadZone

      public float getDeadZone()
      Returns the suggested dead zone for this axis. Values less than this can be safely ignored.
      Specified by:
      getDeadZone in interface JoystickAxis
      Returns:
      the radius of the dead zone
    • setDeadZone

      public void setDeadZone(float f)
      Sets/overrides the dead zone for this axis. This indicates that values within +/- deadZone should be ignored.
      Parameters:
      f - the desired radius
    • toString

      public String toString()
      Overrides:
      toString in class Object