public class OSVRInput extends java.lang.Object implements VRInputAPI
Modifier and Type | Field and Description |
---|---|
static byte[] |
leftHand
The left-hand system String.
|
static byte[] |
rightHand
The right-hand system String.
|
Constructor and Description |
---|
OSVRInput(VREnvironment environment)
Create a new OSVR input attached to the given
VR environment . |
Modifier and Type | Method and Description |
---|---|
Vector3f |
getAngularVelocity(int controllerIndex)
Get the controller angular velocity on all axes.
|
Vector2f |
getAxis(int controllerIndex,
VRInputType forAxis)
Get the axis value for the given input on the given controller.
|
Vector2f |
getAxisDeltaSinceLastCall(int controllerIndex,
VRInputType forAxis)
Get the controller axis delta from the last value.
|
float |
getAxisMultiplier()
Get the controller axis multiplier.
|
Vector2f |
getAxisRaw(int controllerIndex,
VRInputType forAxis)
Get the axis value for the given input on the given controller.
|
static byte[] |
getButtonString(boolean left,
byte index)
Get the system String that identifies a controller.
|
Vector3f |
getFinalObserverPosition(int index)
Get the position of the input after all positional tracking is complete.
|
Quaternion |
getFinalObserverRotation(int index)
Get where is the controller pointing, after all rotations are combined.
|
Quaternion |
getOrientation(int index)
Get the orientation of the input.
|
Vector3f |
getPosition(int index)
Get the position of the input.
|
java.lang.Object |
getRawControllerState(int index)
Get the native wrapping of a controller state.
|
VRTrackedController |
getTrackedController(int index)
Get a tracked controller (for example, a hand controller) that is attached to the VR system.
|
int |
getTrackedControllerCount()
Get the number of tracked controllers (for example, hand controllers) attached to the VR system.
|
Vector3f |
getVelocity(int controllerIndex)
Get the controller velocity on all axes.
|
boolean |
init()
Initialize the input.
|
boolean |
isButtonDown(int controllerIndex,
VRInputType checkButton)
Check if the given button is down (more generally if the given input type is activated).
|
boolean |
isInputDeviceTracking(int index)
Check if the input device is actually tracked (i-e if we can obtain a pose from the input).
|
boolean |
isInputFocused()
Check if the VR system has the focus and if it's not used by other process.
|
void |
resetInputSinceLastCall()
Reset the current activation of the inputs.
|
void |
setAxisMultiplier(float set)
Set the controller axis multiplier.
|
void |
swapHands()
Swap the two hands (exchange the hands' controller 1 and 2 indices).
|
void |
triggerHapticPulse(int controllerIndex,
float seconds)
Trigger a haptic pulse on the selected controller for the duration given in parameters (in seconds).
|
void |
updateConnectedControllers()
Update the connected controllers.
|
void |
updateControllerStates()
Update the controller states.
|
boolean |
wasButtonPressedSinceLastCall(int controllerIndex,
VRInputType checkButton)
Check if the given button / input from the given controller has been just pressed / activated.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAnalogActionState, getAnalogActionState, getDigitalActionState, getDigitalActionState, registerActionManifest, setActiveActionSet, triggerHapticAction, triggerHapticAction
public static byte[] leftHand
public static byte[] rightHand
public OSVRInput(VREnvironment environment)
VR environment
.environment
- the VR environment
to which the input is attached.public static byte[] getButtonString(boolean left, byte index)
left
- is the controller is the left one (false
if the right controller is needed).index
- the index of the controller.public boolean isButtonDown(int controllerIndex, VRInputType checkButton)
VRInputAPI
VRInputAPI.registerActionManifest(java.lang.String, java.lang.String)
. Note; action based will only work with the OpenVR apiisButtonDown
in interface VRInputAPI
controllerIndex
- the index of the controller to check.checkButton
- the button / input to check.true
if the button / input is down / activated and false
otherwise.public boolean wasButtonPressedSinceLastCall(int controllerIndex, VRInputType checkButton)
VRInputAPI
VRInputAPI.registerActionManifest(java.lang.String, java.lang.String)
. Note; action based will only work with the OpenVR apiwasButtonPressedSinceLastCall
in interface VRInputAPI
controllerIndex
- the index of the controller.checkButton
- the button / input to check.true
if the given button / input from the given controller has been just pressed / activated and false
otherwise.public void resetInputSinceLastCall()
VRInputAPI
public Vector2f getAxisDeltaSinceLastCall(int controllerIndex, VRInputType forAxis)
VRInputAPI
VRInputAPI.registerActionManifest(java.lang.String, java.lang.String)
. Note; action based will only work with the OpenVR apigetAxisDeltaSinceLastCall
in interface VRInputAPI
controllerIndex
- the index of the controller.forAxis
- the axis.public Vector3f getVelocity(int controllerIndex)
VRInputAPI
getVelocity
in interface VRInputAPI
controllerIndex
- the index of the controller.VRInputAPI.getAngularVelocity(int)
public Vector3f getAngularVelocity(int controllerIndex)
VRInputAPI
getAngularVelocity
in interface VRInputAPI
controllerIndex
- the index of the controller.VRInputAPI.getVelocity(int)
public Vector2f getAxisRaw(int controllerIndex, VRInputType forAxis)
VRInputAPI
VRInputAPI.registerActionManifest(java.lang.String, java.lang.String)
Note; action based will only work with the OpenVR apigetAxisRaw
in interface VRInputAPI
controllerIndex
- the index of the controller.forAxis
- the axis.VRInputAPI.getAxis(int, VRInputType)
public Vector2f getAxis(int controllerIndex, VRInputType forAxis)
VRInputAPI
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 apigetAxis
in interface VRInputAPI
controllerIndex
- the index of the controller.forAxis
- the axis.VRInputAPI.getAxisRaw(int, VRInputType)
,
VRInputAPI.getAxisMultiplier()
public boolean init()
VRInputAPI
init
in interface VRInputAPI
true
if the initialization is successful and false
otherwise.public int getTrackedControllerCount()
VRInputAPI
getTrackedControllerCount
in interface VRInputAPI
VRInputAPI.getTrackedController(int)
public void updateConnectedControllers()
VRInputAPI
updateConnectedControllers
in interface VRInputAPI
public void updateControllerStates()
VRInputAPI
updateControllerStates
in interface VRInputAPI
public java.lang.Object getRawControllerState(int index)
VRInputAPI
getRawControllerState
in interface VRInputAPI
index
- the index of the controller.public boolean isInputFocused()
VRInputAPI
isInputFocused
in interface VRInputAPI
true
if the VR system has the focus and false
otherwise.public boolean isInputDeviceTracking(int index)
VRInputAPI
isInputDeviceTracking
in interface VRInputAPI
index
- the index of the controller.true
if the input device is actually tracked and false
otherwise.public Quaternion getOrientation(int index)
VRInputAPI
getOrientation
in interface VRInputAPI
index
- the index of the controller.public Vector3f getPosition(int index)
VRInputAPI
getPosition
in interface VRInputAPI
index
- the index of the controller.public Quaternion getFinalObserverRotation(int index)
VRInputAPI
getFinalObserverRotation
in interface VRInputAPI
index
- the index of the controller.public Vector3f getFinalObserverPosition(int index)
VRInputAPI
getFinalObserverPosition
in interface VRInputAPI
index
- the index of the controller.public void triggerHapticPulse(int controllerIndex, float seconds)
VRInputAPI
triggerHapticPulse
in interface VRInputAPI
controllerIndex
- the index of the controller.seconds
- the duration of the pulse in seconds.public void swapHands()
VRInputAPI
swapHands
in interface VRInputAPI
public float getAxisMultiplier()
VRInputAPI
getAxisMultiplier
in interface VRInputAPI
VRInputAPI.setAxisMultiplier(float)
public void setAxisMultiplier(float set)
VRInputAPI
setAxisMultiplier
in interface VRInputAPI
set
- the controller axis multiplier.VRInputAPI.getAxisMultiplier()
public VRTrackedController getTrackedController(int index)
VRInputAPI
getTrackedController
in interface VRInputAPI
index
- the index of the controller.VRInputAPI.getTrackedControllerCount()