From c7a19d2859e01fc08cdd0892e1c5588d0345498f Mon Sep 17 00:00:00 2001 From: Nyabsi Date: Wed, 7 Aug 2024 22:54:09 +0300 Subject: [PATCH] add new mounting settings --- src/TrackedController.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/TrackedController.cpp b/src/TrackedController.cpp index a7218a1..fd9d8a7 100644 --- a/src/TrackedController.cpp +++ b/src/TrackedController.cpp @@ -206,14 +206,24 @@ void TrackedController::UpdatePose(LeapHand hand) m_pose.qDriverFromHeadRotation.w = 1; - if (vr::VRSettings()->GetBool("driver_leapify", "manualMountingOffsetEnabled")) + if (vr::VRSettings()->GetBool("driver_leapify", "manualMountingTranslationOffset")) { - glm::vec3 worldOffset = headRotation * glm::vec3(vr::VRSettings()->GetFloat("driver_leapify", "manualMountingOffsetX"), vr::VRSettings()->GetFloat("driver_leapify", "manualMountingOffsetZ"), vr::VRSettings()->GetFloat("driver_leapify", "manualMountingOffsetY")); + glm::vec3 worldOffset = headRotation * glm::vec3(vr::VRSettings()->GetFloat("driver_leapify", "manualMountingTranslationOffsetX"), vr::VRSettings()->GetFloat("driver_leapify", "manualMountingTranslationOffsetZ"), vr::VRSettings()->GetFloat("driver_leapify", "manualMountingTranslationOffsetY")); + m_pose.vecWorldFromDriverTranslation[0] += worldOffset.x; m_pose.vecWorldFromDriverTranslation[1] += worldOffset.y; m_pose.vecWorldFromDriverTranslation[2] += worldOffset.z; } + if (vr::VRSettings()->GetBool("driver_leapify", "manualMountingOrientationOffset")) + { + glm::vec3 worldOffset = headRotation * glm::vec3(vr::VRSettings()->GetFloat("driver_leapify", "manualMountingOrientationOffsetX"), vr::VRSettings()->GetFloat("driver_leapify", "manualMountingOrientationOffsetY"), vr::VRSettings()->GetFloat("driver_leapify", "manualMountingOrientationOffsetZ")); + + m_pose.qWorldFromDriverRotation.x += worldOffset.x; + m_pose.qWorldFromDriverRotation.y += worldOffset.y; + m_pose.qWorldFromDriverRotation.z += worldOffset.z; + } + glm::quat root = headRotation * glm::quat(glm::radians(glm::vec3(0.0f, 0.0f, 0.0f))); ConvertQuaternion(root, m_pose.qWorldFromDriverRotation);