You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my overlay app, I tried retrieving the joystick values of the controllers via GetControllerState (deprecated) and separately GetAnalogActionData. However, both result in errors saying the handlers are invalid.
OpenVR version: 2.5.1
HMD: Meta Quest 3
Wireless method: I tried Steam Link, Meta Air Link, and Virtual Desktop
Detailed Explanation
I have both an overlay app and driver that are used to send joystick values from a treadmill like peripheral to games. I'm now working on being able to retrieve joystick values from the controllers and sending that to the peripheral device.
I have tried both the deprecated method of using GetControllerState and using action handles in VRInput, but I'm not able to get either method working. I'll go through simplified snippets of my code and explain what I'm doing, and at the end of this post I'll also show all the code in one block.
For the VRInput method I'm first calling GetInputSourceHandle.
auto controllerError = vr::VRInput()->GetInputSourceHandle("/user/hand/right",&controllerHandle);
if (controllerError != vr::VRInputError_None)
{
//log error
}
I then call GetActionSetHandle.
auto controllerActionSetError = vr::VRInput()->GetActionSetHandle("/actions/dualanalog", &actionSetHandle);
if (controllerActionSetError != vr::VRInputError_None)
{
//log error
}
I got the action set and actions string by looking at the action manifest file here: C:\Program Files (x86)\Steam\steamapps\common\SteamVR\resources\config\vrcompositor_actions.json
I also tried using the action manifest file for a game, Arizona Sunshine 2, but that did not work either. The file was located at:
C:\Program Files (x86)\Steam\steamapps\common\Arizona Sunshine 2\ArizonaSunshine2_Data\StreamingAssets\SteamVR\actions.json
I then call GetActionHandle.
auto controllerActionError = vr::VRInput()->GetActionHandle("/actions/dualanalog/in/RightValue", &actionHandle);
if (controllerActionError != vr::VRInputError_None)
{
//log error
}
When I want to retrieve the joystick values I first call UpdateActionState.
Finally, I tried this method to get the handler to pass to GetControllerState, but it still returns false.
vr::TrackedDeviceIndex_t indices[10];
auto size = vr::VRSystem()->GetSortedTrackedDeviceIndicesOfClass(
vr::ETrackedDeviceClass::TrackedDeviceClass_Controller,
indices,
10
);
if (size > 10)
{
//logreturnfalse;
}
else
{
if (size < 2)
{
//logreturnfalse;
}
RightControllerDeviceIndex = indices[0];
}
if (!vr::VRSystem()->GetControllerState(RightControllerDeviceIndex, RightControllerState, sizeof(RightControllerState)))
{
//log issue
}
Is there an issue with these methods for retrieving the controller joystick values, or am I doing something wrong?
Full Code
Here is my code again, but in two blocks and not simplified. I've commented out my logging calls so you can copy paste this code more easily if you want.
Summary
In my overlay app, I tried retrieving the joystick values of the controllers via
GetControllerState
(deprecated) and separatelyGetAnalogActionData
. However, both result in errors saying the handlers are invalid.Detailed Explanation
I have both an overlay app and driver that are used to send joystick values from a treadmill like peripheral to games. I'm now working on being able to retrieve joystick values from the controllers and sending that to the peripheral device.
I have tried both the deprecated method of using
GetControllerState
and using action handles inVRInput
, but I'm not able to get either method working. I'll go through simplified snippets of my code and explain what I'm doing, and at the end of this post I'll also show all the code in one block.For the VRInput method I'm first calling
GetInputSourceHandle
.I then call
GetActionSetHandle
.I got the action set and actions string by looking at the action manifest file here: C:\Program Files (x86)\Steam\steamapps\common\SteamVR\resources\config\vrcompositor_actions.json
I also tried using the action manifest file for a game, Arizona Sunshine 2, but that did not work either. The file was located at:
C:\Program Files (x86)\Steam\steamapps\common\Arizona Sunshine 2\ArizonaSunshine2_Data\StreamingAssets\SteamVR\actions.json
I then call
GetActionHandle
.When I want to retrieve the joystick values I first call
UpdateActionState
.All of the calls above do not return any errors. Once I try to call
GetAnalogActionData
, that's when the error shows up.The call to
GetAnalogActionData
above returns 3, which isVRInputError_InvalidHandle
.Below is an alternative method I used to try to get the joystick values, via
GetControllerState
. But it always returns false.Finally, I tried this method to get the handler to pass to
GetControllerState
, but it still returns false.Is there an issue with these methods for retrieving the controller joystick values, or am I doing something wrong?
Full Code
Here is my code again, but in two blocks and not simplified. I've commented out my logging calls so you can copy paste this code more easily if you want.
ControllersAxesGetter.h
ControllersAxesGetter.cpp
The text was updated successfully, but these errors were encountered: