Open bmwesting opened 8 years ago
I just ran into exactly the same problem with OpenVR 1.0.6 and the consumer version of the Vive.
Just like for @bmwesting, after I call IVRSystem::GetControllerState(deviceIdx, &state, sizeof(state))
, state.rAxis[k_eControllerAxis_None]
reports the trackpad position and state.rAxis[k_eControllerAxis_TrackPad]
reports the trigger value.
Those enums are returned by the tracked property methods to determine what type of input is attached to each axis.
For example, you can loop over the axis like so:
for(uint32_t i = 0; i < vr::k_unControllerStateAxisCount; i++) {
vr::EVRControllerAxisType type = vr::VRSystem()->GetInt32TrackedDeviceProperty(deviceId, Prop_Axis0Type_Int32 + i);
cout << "Axis " << i << " type: " << vr::VRSystem()->GetControllerAxisTypeNameFromEnum(type) << endl;
}
Will output something like:
Axis 0 type: k_eControllerAxis_TrackPad
Axis 1 type: k_eControllerAxis_Trigger
Though obviously this will depend on the controller you are using.
If you really want to hard code the axis like that, you could do something like this:
state.rAxis[vr::k_EButton_SteamVR_Touchpad-vr::k_EButton_Axis0]
state.rAxis[vr::k_EButton_SteamVR_Trigger-vr::k_EButton_Axis0]
Oh, that makes sense. Thank you!
Experimental usage is showing that the enumerations appear to be named incorrectly. According to OpenVR.h:
However, in using the Vive DK1 controller, I see: k_eControllerAxis_None reporting the touchpad axis values, and k_eControllerAxis_TrackPad reporting the trigger values.
Perhaps this is a driver-side issue?