mirror of
https://github.com/overte-org/overte.git
synced 2025-07-10 15:18:42 +02:00
xrNoHandTracking option, tweak offsets for non-vive controllers
This commit is contained in:
parent
ec94000432
commit
a2dd909ce2
4 changed files with 30 additions and 10 deletions
|
@ -286,10 +286,14 @@ int main(int argc, const char* argv[]) {
|
|||
"getProtocolVersionData",
|
||||
"Debug option. Returns the network protocol detailed data in JSON."
|
||||
);
|
||||
QCommandLineOption useExperimentalXR(
|
||||
QCommandLineOption useExperimentalXROption(
|
||||
"useExperimentalXR",
|
||||
"Enables the experimental OpenXR plugin and disables the OpenVR plugin. Some features available in OpenVR aren't yet available in OpenXR."
|
||||
);
|
||||
QCommandLineOption xrNoHandTrackingOption(
|
||||
"xrNoHandTracking",
|
||||
"Debug option. Disables OpenXR hand tracking, even if it's supported by the runtime."
|
||||
);
|
||||
|
||||
// "--qmljsdebugger", which appears in output from "--help-all".
|
||||
// Those below don't seem to be optional.
|
||||
|
@ -339,7 +343,8 @@ int main(int argc, const char* argv[]) {
|
|||
parser.addOption(getPluginsOption);
|
||||
parser.addOption(getProtocolVersionHashOption);
|
||||
parser.addOption(getProtocolVersionDataOption);
|
||||
parser.addOption(useExperimentalXR);
|
||||
parser.addOption(useExperimentalXROption);
|
||||
parser.addOption(xrNoHandTrackingOption);
|
||||
|
||||
|
||||
QString applicationPath;
|
||||
|
|
|
@ -243,6 +243,11 @@ bool OpenXrContext::initSystem() {
|
|||
next = reinterpret_cast<const XrExtensionProperties*>(next->next);
|
||||
}
|
||||
|
||||
// don't start up hand tracking stuff if it's force disabled
|
||||
if (qApp->arguments().contains("--xrNoHandTracking")) {
|
||||
_handTrackingSupported = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,9 +81,9 @@ public:
|
|||
|
||||
bool _handTrackingSupported = false;
|
||||
|
||||
PFN_xrCreateHandTrackerEXT xrCreateHandTrackerEXT;
|
||||
PFN_xrLocateHandJointsEXT xrLocateHandJointsEXT;
|
||||
PFN_xrDestroyHandTrackerEXT xrDestroyHandTrackerEXT;
|
||||
PFN_xrCreateHandTrackerEXT xrCreateHandTrackerEXT = nullptr;
|
||||
PFN_xrLocateHandJointsEXT xrLocateHandJointsEXT = nullptr;
|
||||
PFN_xrDestroyHandTrackerEXT xrDestroyHandTrackerEXT = nullptr;
|
||||
|
||||
private:
|
||||
XrSessionState _lastSessionState = XR_SESSION_STATE_UNKNOWN;
|
||||
|
|
|
@ -541,7 +541,7 @@ bool OpenXrInputPlugin::InputDevice::initActions() {
|
|||
{"/interaction_profiles/valve/index_controller", {
|
||||
{"left_primary_click", hand_left + "/a/click"},
|
||||
{"left_secondary_click", hand_left + "/b/click"},
|
||||
{"left_squeeze_value", hand_left + "/squeeze/value"},
|
||||
{"left_squeeze_value", hand_left + "/squeeze/force"},
|
||||
{"left_trigger_value", hand_left + "/trigger/value"},
|
||||
{"left_trigger_click", hand_left + "/trigger/click"},
|
||||
{"left_thumbstick", hand_left + "/thumbstick"},
|
||||
|
@ -552,7 +552,7 @@ bool OpenXrInputPlugin::InputDevice::initActions() {
|
|||
|
||||
{"right_primary_click", hand_right + "/a/click"},
|
||||
{"right_secondary_click", hand_right + "/b/click"},
|
||||
{"right_squeeze_value", hand_right + "/squeeze/value"},
|
||||
{"right_squeeze_value", hand_right + "/squeeze/force"},
|
||||
{"right_trigger_value", hand_right + "/trigger/value"},
|
||||
{"right_trigger_click", hand_right + "/trigger/click"},
|
||||
{"right_thumbstick", hand_right + "/thumbstick"},
|
||||
|
@ -662,9 +662,19 @@ void OpenXrInputPlugin::InputDevice::update(float deltaTime, const controller::I
|
|||
glm::mat4 handOffset = i == 0 ? glm::toMat4(leftRotationOffset) : glm::toMat4(rightRotationOffset);
|
||||
|
||||
glm::mat4 posOffset(1.0f);
|
||||
posOffset *= glm::translate(glm::vec3(handOffset[0]) * (i == 0 ? 0.1f : -0.1f));
|
||||
posOffset *= glm::translate(glm::vec3(handOffset[1]) * -0.16f);
|
||||
posOffset *= glm::translate(glm::vec3(handOffset[2]) * -0.02f);
|
||||
|
||||
// vive controllers have bugged poses that aren't in the grip or aim position,
|
||||
// they're always at the top near the tracking ring
|
||||
if (_context->_stickEmulation) {
|
||||
posOffset *= glm::translate(glm::vec3(handOffset[0]) * (i == 0 ? 0.1f : -0.1f));
|
||||
posOffset *= glm::translate(glm::vec3(handOffset[1]) * -0.16f);
|
||||
posOffset *= glm::translate(glm::vec3(handOffset[2]) * -0.02f);
|
||||
} else {
|
||||
posOffset *= glm::translate(glm::vec3(handOffset[0]) * (i == 0 ? -0.07f : 0.07f));
|
||||
posOffset *= glm::translate(glm::vec3(handOffset[1]) * -0.10f);
|
||||
posOffset *= glm::translate(glm::vec3(handOffset[2]) * -0.01f);
|
||||
}
|
||||
|
||||
_poseStateMap[i == 0 ? controller::LEFT_HAND : controller::RIGHT_HAND] =
|
||||
pose.postTransform(posOffset).postTransform(handOffset).transform(sensorToAvatar);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue