public interface VRInputAPI
Modifier and Type | Method and Description |
---|---|
default AnalogActionState |
getAnalogActionState(java.lang.String actionName)
Gets the current state of the action (abstract version of a button press).
|
default AnalogActionState |
getAnalogActionState(java.lang.String actionName,
java.lang.String restrictToInput)
Gets the current state of the action (abstract version of a button press).
|
Vector3f |
getAngularVelocity(int controllerIndex)
Get the controller angular velocity on all axes.
|
Vector2f |
getAxis(int controllerIndex,
VRInputType forAxis)
Deprecated.
|
Vector2f |
getAxisDeltaSinceLastCall(int controllerIndex,
VRInputType forAxis)
Deprecated.
|
float |
getAxisMultiplier()
Get the controller axis multiplier.
|
Vector2f |
getAxisRaw(int controllerIndex,
VRInputType forAxis)
Deprecated.
|
default DigitalActionState |
getDigitalActionState(java.lang.String actionName)
Gets the current state of the action (abstract version of a button press).
|
default DigitalActionState |
getDigitalActionState(java.lang.String actionName,
java.lang.String restrictToInput)
Gets the current state of the action (abstract version of a button press).
|
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)
Deprecated.
|
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.
|
default void |
registerActionManifest(java.lang.String actionManifestAbsolutePath,
java.lang.String startingActiveActionSet)
Registers an action manifest.
|
void |
resetInputSinceLastCall()
Deprecated.
|
default void |
setActiveActionSet(java.lang.String activeActionSet)
Updates the active action set (the action group that will have their states available to be polled).
|
void |
setAxisMultiplier(float set)
Set the controller axis multiplier.
|
void |
swapHands()
Swap the two hands (exchange the hands' controller 1 and 2 indices).
|
default void |
triggerHapticAction(java.lang.String actionName,
float duration,
float frequency,
float amplitude)
Triggers a haptic action (aka a vibration).
|
default void |
triggerHapticAction(java.lang.String actionName,
float duration,
float frequency,
float amplitude,
java.lang.String restrictToInput)
Triggers a haptic action (aka a vibration) restricted to just one input (e.g.
|
void |
triggerHapticPulse(int controllerIndex,
float seconds)
Deprecated.
|
void |
updateConnectedControllers()
Update the connected controllers.
|
void |
updateControllerStates()
Update the controller states.
|
boolean |
wasButtonPressedSinceLastCall(int controllerIndex,
VRInputType checkButton)
Deprecated.
|
default void registerActionManifest(java.lang.String actionManifestAbsolutePath, java.lang.String startingActiveActionSet)
isButtonDown(int, com.jme3.input.vr.VRInputType)
will no longer work
See https://github.com/ValveSoftware/openvr/wiki/Action-manifest for documentation on how to create an
action manifest
This option is only relevant to OpenVRactionManifestAbsolutePath
- the absolute file path to an actions manifeststartingActiveActionSet
- the actions in the manifest are divided into action sets (groups) by their prefix (e.g. "/actions/main").
These action sets can be turned off and on per frame. This argument sets the action set that will be
active now. The active action sets can be later be changed by calling setActiveActionSet(java.lang.String)
.
Note that at present only a single set at a time is supporteddefault void setActiveActionSet(java.lang.String activeActionSet)
activeActionSet
- the actions in the manifest are divided into action sets (groups) by their prefix (e.g. "/actions/main").
These action sets can be turned off and on per frame. This argument sets the action set that will be
active now.default DigitalActionState getDigitalActionState(java.lang.String actionName)
getDigitalActionState(String, String)
registerActionManifest(java.lang.String, java.lang.String)
must have been called before using this method.actionName
- The name of the action. Will be something like /actions/main/in/openInventorydefault DigitalActionState getDigitalActionState(java.lang.String actionName, java.lang.String restrictToInput)
registerActionManifest(java.lang.String, java.lang.String)
must have been called before using this method.actionName
- The name of the action. E.g. /actions/main/in/openInventoryrestrictToInput
- the input to restrict the action to. E.g. /user/hand/right. Or null, which means "any input"default AnalogActionState getAnalogActionState(java.lang.String actionName)
getAnalogActionState(String, String)
registerActionManifest(java.lang.String, java.lang.String)
must have been called before using this method.actionName
- The name of the action. E.g. /actions/main/in/openInventorydefault AnalogActionState getAnalogActionState(java.lang.String actionName, java.lang.String restrictToInput)
registerActionManifest(java.lang.String, java.lang.String)
must have been called before using this method.actionName
- The name of the action. E.g. /actions/main/in/openInventoryrestrictToInput
- the input to restrict the action to. E.g. /user/hand/right. Or null, which means "any input"@Deprecated boolean isButtonDown(int controllerIndex, VRInputType checkButton)
registerActionManifest(java.lang.String, java.lang.String)
. Note; action based will only work with the OpenVR apicontrollerIndex
- the index of the controller to check.checkButton
- the button / input to check.true
if the button / input is down / activated and false
otherwise.@Deprecated boolean wasButtonPressedSinceLastCall(int controllerIndex, VRInputType checkButton)
registerActionManifest(java.lang.String, java.lang.String)
. Note; action based will only work with the OpenVR apicontrollerIndex
- 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.@Deprecated void resetInputSinceLastCall()
@Deprecated Vector2f getAxisDeltaSinceLastCall(int controllerIndex, VRInputType forAxis)
registerActionManifest(java.lang.String, java.lang.String)
. Note; action based will only work with the OpenVR apicontrollerIndex
- the index of the controller.forAxis
- the axis.Vector3f getVelocity(int controllerIndex)
controllerIndex
- the index of the controller.getAngularVelocity(int)
Vector3f getAngularVelocity(int controllerIndex)
controllerIndex
- the index of the controller.getVelocity(int)
@Deprecated Vector2f getAxis(int controllerIndex, VRInputType forAxis)
raw value
multiplied by the axis multiplier
.
Deprecated as should use an actions manifest approach. See registerActionManifest(java.lang.String, java.lang.String)
. Note; action based will only work with the OpenVR apicontrollerIndex
- the index of the controller.forAxis
- the axis.getAxisRaw(int, VRInputType)
,
getAxisMultiplier()
@Deprecated Vector2f getAxisRaw(int controllerIndex, VRInputType forAxis)
registerActionManifest(java.lang.String, java.lang.String)
Note; action based will only work with the OpenVR apicontrollerIndex
- the index of the controller.forAxis
- the axis.getAxis(int, VRInputType)
boolean init()
true
if the initialization is successful and false
otherwise.int getTrackedControllerCount()
getTrackedController(int)
VRTrackedController getTrackedController(int index)
index
- the index of the controller.getTrackedControllerCount()
void updateConnectedControllers()
void updateControllerStates()
java.lang.Object getRawControllerState(int index)
index
- the index of the controller.void swapHands()
float getAxisMultiplier()
setAxisMultiplier(float)
void setAxisMultiplier(float set)
set
- the controller axis multiplier.getAxisMultiplier()
boolean isInputFocused()
true
if the VR system has the focus and false
otherwise.boolean isInputDeviceTracking(int index)
index
- the index of the controller.true
if the input device is actually tracked and false
otherwise.Quaternion getOrientation(int index)
index
- the index of the controller.Vector3f getPosition(int index)
index
- the index of the controller.Quaternion getFinalObserverRotation(int index)
index
- the index of the controller.Vector3f getFinalObserverPosition(int index)
index
- the index of the controller.@Deprecated void triggerHapticPulse(int controllerIndex, float seconds)
controllerIndex
- the index of the controller.seconds
- the duration of the pulse in seconds.default void triggerHapticAction(java.lang.String actionName, float duration, float frequency, float amplitude)
triggerHapticAction(String, float, float, float, String)
to control which input it gets set to at run timeactionName
- The name of the action. Will be something like /actions/main/out/vibrateduration
- how long in seconds thefrequency
- in cycles per secondamplitude
- between 0 and 1default void triggerHapticAction(java.lang.String actionName, float duration, float frequency, float amplitude, java.lang.String restrictToInput)
actionName
- The name of the action. Will be something like /actions/main/out/vibrateduration
- how long in seconds thefrequency
- in cycles per secondamplitude
- between 0 and 1restrictToInput
- the input to restrict the action to. E.g. /user/hand/right, /user/hand/left. Or null, which means "any input"