Quake VR - Smooth Locomotion and Turning not working
My Quake VR mod uses the new SteamVR/OpenVR API for inputs. Everything except smooth locomotion and turning work under OpenComposite.
Maybe there is a bug in OpenComposite or something that I am doing wrong with my implementation of SteamVR input for thumbstick locomotion and turning. This is what I have in my actions.json:
{
"actions":
[
{
"name": "/actions/default/in/Locomotion",
"type": "vector2"
},
// ...
]
}
And this is what I have in my bindings_touch.json:
{
"sources":
[
{
"inputs": {
"position": {
"output": "/actions/default/in/Locomotion"
}
},
"mode": "joystick",
"path": "/user/hand/left/input/thumbstick"
},
// ...
]
}
The way I then process these actions is by using OpenVR's analog action API:
//
// Global variable:
vr::VRActionHandle_t vrahLocomotion;
//
// During initialization:
vr::VRInput()->GetActionHandle("/actions/default/in/Locomotion", &vrahLocomotion);
//
// Per-frame:
vr::InputAnalogActionData_t inpLocomotion;
vr::VRInput()->GetAnalogActionData(
vrahLocomotion,
&inpLocomotion,
sizeof(vr::InputAnalogActionData_t),
vr::k_ulInvalidInputValueHandle
);
movePlayer(inpLocomotion.y, inpLocomotion.x);
The code above is simplified, I perform error handling for every OpenVR function. The signature of GetAnalogActionData is as follows:
/** Reads the state of an analog action given its handle. This will
* return VRInputError_WrongType if the type of action is something
* other than analog */
virtual EVRInputError GetAnalogActionData(VRActionHandle_t action,
InputAnalogActionData_t* pActionData, uint32_t unActionDataSize,
VRInputValueHandle_t ulRestrictToDevice) = 0;
I am using an invalid handle for ulRestrictToDevice as I don't want to restrict to any device. I am using the exact same technique for digital actions and they work fine in OpenComposite.
Quake VR input source code available here: