Class SpaceNavigatorController


  • public class SpaceNavigatorController
    extends java.lang.Object
    Allows for controlling a SpaceNavigator, could also be generalized for any joystick-type device. Details for: SpaceNavigator, Stick, Unknown Components: (8) 0. Z Axis, z, relative, analog, 0.0 1. Y Axis, y, relative, analog, 0.0 2. X Axis, x, relative, analog, 0.0 3. Z Rotation, rz, relative, analog, 0.0 4. Y Rotation, ry, relative, analog, 0.0 5. X Rotation, rx, relative, analog, 0.0 6. Button 0, 0, absolute, digital, 0.0 7. Button 1, 1, absolute, digital, 0.0 No Rumblers No subcontrollers
    Author:
    justinsenseney
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean checkIfSpaceNavNeedsCalibration()  
      private static int findCompIndex​(net.java.games.input.Component[] comps, net.java.games.input.Component.Identifier id, java.lang.String nm)  
      private static net.java.games.input.Controller findSpaceNavigator​(net.java.games.input.Controller[] cs)  
      static boolean[] getButtons()
      Return all the buttons in a single array.
      static float getRX()
      X Rotation
      static float getRY()
      Y Rotation
      static float getRZ()
      Z Rotation
      static float getTX()
      X Translation
      static float getTY()
      Y Translation
      static float getTZ()
      Z Translation
      static boolean hasSpaceNavigator()  
      private static boolean isButton​(net.java.games.input.Component c)
      Return true if the component is a digital/absolute button, and its identifier name ends with "Button" (i.e. the identifier class is Component.Identifier.Button).
      static boolean isButtonPressed​(int pos)  
      static void poll()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MAX_ROTATION

        private static final float MAX_ROTATION
        values returned by the device during poll (may not be correct)
        See Also:
        Constant Field Values
      • controller

        private static net.java.games.input.Controller controller
      • comps

        private static final net.java.games.input.Component[] comps
      • xAxisIdx

        public static final int xAxisIdx
        Actual button indices
      • yAxisIdx

        public static final int yAxisIdx
        Actual button indices
      • zAxisIdx

        public static final int zAxisIdx
        Actual button indices
      • rxAxisIdx

        public static final int rxAxisIdx
        Actual button indices
      • ryAxisIdx

        public static final int ryAxisIdx
        Actual button indices
      • rzAxisIdx

        public static final int rzAxisIdx
        Actual button indices
      • buttonsIdx

        private static final int[] buttonsIdx
    • Constructor Detail

      • SpaceNavigatorController

        public SpaceNavigatorController()
    • Method Detail

      • hasSpaceNavigator

        public static boolean hasSpaceNavigator()
      • findSpaceNavigator

        private static net.java.games.input.Controller findSpaceNavigator​(net.java.games.input.Controller[] cs)
      • findCompIndex

        private static int findCompIndex​(net.java.games.input.Component[] comps,
                                         net.java.games.input.Component.Identifier id,
                                         java.lang.String nm)
      • isButton

        private static boolean isButton​(net.java.games.input.Component c)
        Return true if the component is a digital/absolute button, and its identifier name ends with "Button" (i.e. the identifier class is Component.Identifier.Button).
      • getButtons

        public static boolean[] getButtons()
        Return all the buttons in a single array. Each button value is a boolean.
      • isButtonPressed

        public static boolean isButtonPressed​(int pos)
      • poll

        public static void poll()
      • getTX

        public static float getTX()
        X Translation
        Returns:
        float value between .613 and -.613
      • getTY

        public static float getTY()
        Y Translation
        Returns:
        float value between .613 and -.613
      • getTZ

        public static float getTZ()
        Z Translation
        Returns:
        float value between .613 and -.613
      • getRX

        public static float getRX()
        X Rotation
        Returns:
        float value between .560 and -.560
      • getRY

        public static float getRY()
        Y Rotation
        Returns:
        float value between .560 and -.560
      • getRZ

        public static float getRZ()
        Z Rotation
        Returns:
        float value between .560 and -.560
      • checkIfSpaceNavNeedsCalibration

        public static boolean checkIfSpaceNavNeedsCalibration()