3
0
Fork 0
mirror of https://github.com/JulianGro/overte.git synced 2025-04-29 19:42:53 +02:00

OpenXrInput: Map more Index controller.

* Add thumbstick click and touch.

* Add face and trigger touch.
This commit is contained in:
Lubosz Sarnecki 2024-03-13 01:41:18 +01:00
parent 5cf56caf81
commit 7f4a489945
2 changed files with 34 additions and 0 deletions
interface/resources/controllers
plugins/openxr/src

View file

@ -27,6 +27,8 @@
{ "from": "Index.LX", "to": "Standard.LX" },
{ "from": "Index.RY", "to": "Standard.RY" },
{ "from": "Index.RX", "to": "Standard.RX" },
{ "from": "Index.LS", "to": "Standard.LS" },
{ "from": "Index.RS", "to": "Standard.RS" },
{ "from": "Index.LSTouch", "to": "Standard.LSTouch" },
{ "from": "Index.RSTouch", "to": "Standard.RSTouch" },

View file

@ -302,18 +302,29 @@ controller::Input::NamedVector OpenXrInputPlugin::InputDevice::getAvailableInput
// Sticks
makePair(LX, "LX"),
makePair(LY, "LY"),
makePair(LS, "LS"),
makePair(LS_TOUCH, "LSTouch"),
makePair(RX, "RX"),
makePair(RY, "RY"),
makePair(RS, "RS"),
makePair(RS_TOUCH, "RSTouch"),
// Face buttons
makePair(A, "A"),
makePair(RIGHT_PRIMARY_THUMB_TOUCH, "RightPrimaryThumbTouch"),
makePair(B, "B"),
makePair(RIGHT_SECONDARY_THUMB_TOUCH, "RightSecondaryThumbTouch"),
makePair(X, "X"),
makePair(LEFT_PRIMARY_THUMB_TOUCH, "LeftPrimaryThumbTouch"),
makePair(Y, "Y"),
makePair(LEFT_SECONDARY_THUMB_TOUCH, "LeftSecondaryThumbTouch"),
// Triggers
makePair(RT, "RT"),
makePair(LT, "LT"),
makePair(RT_CLICK, "RTClick"),
makePair(LT_CLICK, "LTClick"),
makePair(LEFT_PRIMARY_INDEX_TOUCH, "LeftPrimaryIndexTouch"),
makePair(RIGHT_PRIMARY_INDEX_TOUCH, "RightPrimaryIndexTouch"),
// Menu buttons
// TODO: Add this to button channel
// Input::NamedPair(Input(_deviceID, LEFT_APP_MENU, ChannelType::BUTTON), "LeftApplicationMenu"),
@ -350,10 +361,15 @@ bool OpenXrInputPlugin::InputDevice::initActions() {
std::map<std::string, XrActionType> actionsToInit = {
{ "/input/thumbstick/x", XR_ACTION_TYPE_FLOAT_INPUT },
{ "/input/thumbstick/y", XR_ACTION_TYPE_FLOAT_INPUT },
{ "/input/thumbstick/touch", XR_ACTION_TYPE_BOOLEAN_INPUT },
{ "/input/thumbstick/click", XR_ACTION_TYPE_BOOLEAN_INPUT },
{ "/input/a/click", XR_ACTION_TYPE_BOOLEAN_INPUT },
{ "/input/a/touch", XR_ACTION_TYPE_BOOLEAN_INPUT },
{ "/input/b/click", XR_ACTION_TYPE_BOOLEAN_INPUT },
{ "/input/b/touch", XR_ACTION_TYPE_BOOLEAN_INPUT },
{ "/input/trigger/value", XR_ACTION_TYPE_FLOAT_INPUT },
{ "/input/trigger/click", XR_ACTION_TYPE_BOOLEAN_INPUT },
{ "/input/trigger/touch", XR_ACTION_TYPE_BOOLEAN_INPUT },
{ "/output/haptic", XR_ACTION_TYPE_VIBRATION_OUTPUT },
{ "/input/grip/pose", XR_ACTION_TYPE_POSE_INPUT },
{ "/input/select/click", XR_ACTION_TYPE_BOOLEAN_INPUT },
@ -387,9 +403,15 @@ bool OpenXrInputPlugin::InputDevice::initActions() {
"/input/grip/pose",
"/input/thumbstick/x",
"/input/thumbstick/y",
"/input/thumbstick/touch",
"/input/thumbstick/click",
"/input/a/click",
"/input/a/touch",
"/input/b/click",
"/input/b/touch",
"/input/trigger/value",
"/input/trigger/click",
"/input/trigger/touch",
"/output/haptic",
"/input/system/click",
};
@ -487,14 +509,24 @@ void OpenXrInputPlugin::InputDevice::update(float deltaTime, const controller::I
std::map<controller::StandardButtonChannel, std::string> buttonsToUpdate[2] = {
{
{ controller::X, "/input/a/click" },
{ controller::LEFT_PRIMARY_THUMB_TOUCH, "/input/a/touch" },
{ controller::Y, "/input/b/click" },
{ controller::LEFT_SECONDARY_THUMB_TOUCH, "/input/b/touch" },
{ controller::LT_CLICK, "/input/trigger/click" },
{ controller::LEFT_PRIMARY_INDEX_TOUCH, "/input/trigger/touch" },
{ controller::LS, "/input/thumbstick/click" },
{ controller::LS_TOUCH, "/input/thumbstick/touch" },
//{ LEFT_APP_MENU, "/input/system/click" },
},
{
{ controller::A, "/input/a/click" },
{ controller::RIGHT_PRIMARY_THUMB_TOUCH, "/input/a/touch" },
{ controller::B, "/input/b/click" },
{ controller::RIGHT_SECONDARY_THUMB_TOUCH, "/input/b/touch" },
{ controller::RT_CLICK, "/input/trigger/click" },
{ controller::RIGHT_PRIMARY_INDEX_TOUCH, "/input/trigger/touch" },
{ controller::RS, "/input/thumbstick/click" },
{ controller::RS_TOUCH, "/input/thumbstick/touch" },
//{ RIGHT_APP_MENU, "/input/system/click" },
},
};