Class OculusVRInput

java.lang.Object
com.jme3.input.vr.oculus.OculusVRInput
All Implemented Interfaces:
VRInputAPI

public class OculusVRInput extends Object implements VRInputAPI
  • Constructor Details

    • OculusVRInput

      public OculusVRInput(OculusVR hardware, long session, org.lwjgl.ovr.OVRSessionStatus sessionStatus, org.lwjgl.ovr.OVRTrackingState trackingState)
  • Method Details

    • dispose

      public void dispose()
    • updateControllerStates

      public void updateControllerStates()
      Description copied from interface: VRInputAPI
      Update the controller states. This method should be called before accessing any controller data.
      Specified by:
      updateControllerStates in interface VRInputAPI
    • getPosition

      public Vector3f getPosition(int index)
      Description copied from interface: VRInputAPI
      Get the position of the input.
      Specified by:
      getPosition in interface VRInputAPI
      Parameters:
      index - the index of the controller.
      Returns:
      the position of the input.
    • getVelocity

      public Vector3f getVelocity(int controllerIndex)
      Description copied from interface: VRInputAPI
      Get the controller velocity on all axes.
      Specified by:
      getVelocity in interface VRInputAPI
      Parameters:
      controllerIndex - the index of the controller.
      Returns:
      the controller velocity on all axes.
      See Also:
    • getOrientation

      public Quaternion getOrientation(int index)
      Description copied from interface: VRInputAPI
      Get the orientation of the input.
      Specified by:
      getOrientation in interface VRInputAPI
      Parameters:
      index - the index of the controller.
      Returns:
      the orientation of the input.
    • getAngularVelocity

      public Vector3f getAngularVelocity(int controllerIndex)
      Description copied from interface: VRInputAPI
      Get the controller angular velocity on all axes.
      Specified by:
      getAngularVelocity in interface VRInputAPI
      Parameters:
      controllerIndex - the index of the controller.
      Returns:
      the controller angular velocity on all axes.
      See Also:
    • getFinalObserverRotation

      public Quaternion getFinalObserverRotation(int index)
      Description copied from interface: VRInputAPI
      Get where is the controller pointing, after all rotations are combined. This position should include observer rotation from the VR application.
      Specified by:
      getFinalObserverRotation in interface VRInputAPI
      Parameters:
      index - the index of the controller.
      Returns:
      the rotation of the input after all positional tracking is complete.
    • getFinalObserverPosition

      public Vector3f getFinalObserverPosition(int index)
      Description copied from interface: VRInputAPI
      Get the position of the input after all positional tracking is complete. This position should include observer position from the VR application.
      Specified by:
      getFinalObserverPosition in interface VRInputAPI
      Parameters:
      index - the index of the controller.
      Returns:
      the position of the input after all positional tracking is complete.
    • isInputDeviceTracking

      public boolean isInputDeviceTracking(int index)
      Description copied from interface: VRInputAPI
      Check if the input device is actually tracked (i-e if we can obtain a pose from the input).
      Specified by:
      isInputDeviceTracking in interface VRInputAPI
      Parameters:
      index - the index of the controller.
      Returns:
      true if the input device is actually tracked and false otherwise.
    • getAxis

      public Vector2f getAxis(int controllerIndex, VRInputType forAxis)
      Description copied from interface: VRInputAPI
      Get the axis value for the given input on the given controller. This value is the raw value multiplied by the axis multiplier. Deprecated as should use an actions manifest approach. See VRInputAPI.registerActionManifest(java.lang.String, java.lang.String). Note; action based will only work with the OpenVR api
      Specified by:
      getAxis in interface VRInputAPI
      Parameters:
      controllerIndex - the index of the controller.
      forAxis - the axis.
      Returns:
      the axis value for the given input on the given controller.
      See Also:
    • getAxisRaw

      public Vector2f getAxisRaw(int controllerIndex, VRInputType forAxis)
      Description copied from interface: VRInputAPI
      Get the axis value for the given input on the given controller. Deprecated as should use an actions manifest approach. See VRInputAPI.registerActionManifest(java.lang.String, java.lang.String) Note; action based will only work with the OpenVR api
      Specified by:
      getAxisRaw in interface VRInputAPI
      Parameters:
      controllerIndex - the index of the controller.
      forAxis - the axis.
      Returns:
      the axis value for the given input on the given controller.
      See Also:
    • isButtonDown

      public boolean isButtonDown(int controllerIndex, VRInputType checkButton)
      Description copied from interface: VRInputAPI
      Check if the given button is down (more generally if the given input type is activated). Deprecated as should use an actions manifest approach. See VRInputAPI.registerActionManifest(java.lang.String, java.lang.String). Note; action based will only work with the OpenVR api
      Specified by:
      isButtonDown in interface VRInputAPI
      Parameters:
      controllerIndex - the index of the controller to check.
      checkButton - the button / input to check.
      Returns:
      true if the button / input is down / activated and false otherwise.
    • isButtonDownForStatus

      public boolean isButtonDownForStatus(int controllerIndex, VRInputType checkButton, int buttons, int touch)
    • resetInputSinceLastCall

      public void resetInputSinceLastCall()
      Description copied from interface: VRInputAPI
      Reset the current activation of the inputs. After a call to this method, all input activation is considered as new activation.
      Specified by:
      resetInputSinceLastCall in interface VRInputAPI
      See Also:
    • wasButtonPressedSinceLastCall

      public boolean wasButtonPressedSinceLastCall(int controllerIndex, VRInputType checkButton)
      Description copied from interface: VRInputAPI
      Check if the given button / input from the given controller has been just pressed / activated. Deprecated as should use an actions manifest approach. See VRInputAPI.registerActionManifest(java.lang.String, java.lang.String). Note; action based will only work with the OpenVR api
      Specified by:
      wasButtonPressedSinceLastCall in interface VRInputAPI
      Parameters:
      controllerIndex - the index of the controller.
      checkButton - the button / input to check.
      Returns:
      true if the given button / input from the given controller has been just pressed / activated and false otherwise.
    • getAxisDeltaSinceLastCall

      public Vector2f getAxisDeltaSinceLastCall(int controllerIndex, VRInputType forAxis)
      Description copied from interface: VRInputAPI
      Get the controller axis delta from the last value. Deprecated as should use an actions manifest approach. See VRInputAPI.registerActionManifest(java.lang.String, java.lang.String). Note; action based will only work with the OpenVR api
      Specified by:
      getAxisDeltaSinceLastCall in interface VRInputAPI
      Parameters:
      controllerIndex - the index of the controller.
      forAxis - the axis.
      Returns:
      the controller axis delta from the last call.
    • init

      public boolean init()
      Description copied from interface: VRInputAPI
      Initialize the input.
      Specified by:
      init in interface VRInputAPI
      Returns:
      true if the initialization is successful and false otherwise.
    • updateConnectedControllers

      public void updateConnectedControllers()
      Description copied from interface: VRInputAPI
      Update the connected controllers. This method should be used just after the initialization of the input.
      Specified by:
      updateConnectedControllers in interface VRInputAPI
    • getAxisMultiplier

      public float getAxisMultiplier()
      Description copied from interface: VRInputAPI
      Get the controller axis multiplier. The controller axis raw data (trackpad, trigger, ...) value is multiplied by the one given in parameter.
      Specified by:
      getAxisMultiplier in interface VRInputAPI
      Returns:
      the controller axis multiplier.
      See Also:
    • setAxisMultiplier

      public void setAxisMultiplier(float axisMultiplier)
      Description copied from interface: VRInputAPI
      Set the controller axis multiplier. The controller axis raw data (trackpad, trigger, ...) value is multiplied by the one given in parameter.
      Specified by:
      setAxisMultiplier in interface VRInputAPI
      Parameters:
      axisMultiplier - the controller axis multiplier.
      See Also:
    • triggerHapticPulse

      public void triggerHapticPulse(int controllerIndex, float seconds)
      Description copied from interface: VRInputAPI
      Trigger a haptic pulse on the selected controller for the duration given in parameters (in seconds). Deprecated, use triggerHapticAction instead (as it has more options and doesn't use deprecated methods)
      Specified by:
      triggerHapticPulse in interface VRInputAPI
      Parameters:
      controllerIndex - the index of the controller.
      seconds - the duration of the pulse in seconds.
    • isInputFocused

      public boolean isInputFocused()
      Description copied from interface: VRInputAPI
      Check if the VR system has the focus and if it's not used by other process.
      Specified by:
      isInputFocused in interface VRInputAPI
      Returns:
      true if the VR system has the focus and false otherwise.
    • getRawControllerState

      public Object getRawControllerState(int index)
      Description copied from interface: VRInputAPI
      Get the native wrapping of a controller state.
      Specified by:
      getRawControllerState in interface VRInputAPI
      Parameters:
      index - the index of the controller.
      Returns:
      the native wrapping of a controller state.
    • swapHands

      public void swapHands()
      Description copied from interface: VRInputAPI
      Swap the two hands (exchange the hands' controller 1 and 2 indices).
      Specified by:
      swapHands in interface VRInputAPI
    • getTrackedControllerCount

      public int getTrackedControllerCount()
      Description copied from interface: VRInputAPI
      Get the number of tracked controllers (for example, hand controllers) attached to the VR system.
      Specified by:
      getTrackedControllerCount in interface VRInputAPI
      Returns:
      the number of controllers attached to the VR system.
      See Also:
    • getTrackedController

      public VRTrackedController getTrackedController(int index)
      Description copied from interface: VRInputAPI
      Get a tracked controller (for example, a hand controller) that is attached to the VR system.
      Specified by:
      getTrackedController in interface VRInputAPI
      Parameters:
      index - the index of the controller.
      Returns:
      the tracked controller (for example, a hand controller) that is attached to the VR system.
      See Also: