From 0fdf1362511bba33acfce53d87e78fae0ef14555 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 24 May 2017 19:31:48 +0100 Subject: [PATCH] got the shoulders working --- interface/resources/avatar/avatar-animation.json | 8 ++++---- libraries/animation/src/Rig.cpp | 6 ++++++ plugins/openvr/src/ViveControllerManager.cpp | 14 +------------- plugins/openvr/src/ViveControllerManager.h | 8 +------- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/interface/resources/avatar/avatar-animation.json b/interface/resources/avatar/avatar-animation.json index 7171d4c223..35f2d4b9af 100644 --- a/interface/resources/avatar/avatar-animation.json +++ b/interface/resources/avatar/avatar-animation.json @@ -121,8 +121,8 @@ "rotationVar": "leftArmRotation", "typeVar": "leftArmType", "weightVar": "leftArmWeight", - "weight": 1.0, - "flexCoefficients": [1, 0.5, 0.25, 0.0, 0.0, 0.0] + "weight": 0.75, + "flexCoefficients": [1.0, 0.35, 0.2, 0.1, 0.05, 0.0, 0.0, 0.0] }, { "jointName": "RightArm", @@ -130,8 +130,8 @@ "rotationVar": "rightArmRotation", "typeVar": "rightArmType", "weightVar": "rightArmWeight", - "weight": 1.0, - "flexCoefficients": [1, 0.5, 0.25, 0.0, 0.0, 0.0] + "weight": 0.75, + "flexCoefficients": [1.0, 0.35, 0.2, 0.1, 0.05, 0.0, 0.0, 0.0] } ] }, diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index c74b8c478b..a423c45597 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -1049,12 +1049,18 @@ void Rig::updateFromHeadParameters(const HeadParameters& params, float dt) { } if (params.leftArmEnabled) { + _animVars.set("leftArmType", (int)IKTarget::Type::RotationAndPosition); + _animVars.set("leftArmPosition", params.leftArmPosition); + _animVars.set("leftArmRotation", params.leftArmRotation); } else { _animVars.set("leftArmType", (int)IKTarget::Type::Unknown); } if (params.rightArmEnabled) { + _animVars.set("rightArmType", (int)IKTarget::Type::RotationAndPosition); + _animVars.set("rightArmPosition", params.rightArmPosition); + _animVars.set("rightArmRotation", params.rightArmRotation); } else { _animVars.set("rightArmType", (int)IKTarget::Type::Unknown); } diff --git a/plugins/openvr/src/ViveControllerManager.cpp b/plugins/openvr/src/ViveControllerManager.cpp index 5e509f43b8..bb0e415af5 100644 --- a/plugins/openvr/src/ViveControllerManager.cpp +++ b/plugins/openvr/src/ViveControllerManager.cpp @@ -178,7 +178,6 @@ ViveControllerManager::InputDevice::InputDevice(vr::IVRSystem*& system) : contro _configStringMap[Config::FeetAndHips] = QString("FeetAndHips"); _configStringMap[Config::FeetHipsAndChest] = QString("FeetHipsAndChest"); _configStringMap[Config::FeetHipsAndShoulders] = QString("FeetHipsAndShoulders"); - _configStringMap[Config::FeetAndShoulders] = QString("FeetAndShoulders"); } void ViveControllerManager::InputDevice::update(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) { @@ -342,11 +341,6 @@ void ViveControllerManager::InputDevice::calibrate(const controller::InputCalibr if (_config == Config::Feet) { calibrateFeet(defaultToReferenceMat, inputCalibration); - } else if (_config == Config::FeetAndShoulders && puckCount >= MIN_FEET_HIPS_CHEST) { - calibrateFeet(defaultToReferenceMat, inputCalibration); - int firstShoulder = 2; - int secondShoulder = 3; - calibrateShoulders(defaultToReferenceMat, inputCalibration, firstShoulder, secondShoulder); } else if (_config == Config::FeetAndHips && puckCount >= MIN_FEET_AND_HIPS) { calibrateFeet(defaultToReferenceMat, inputCalibration); calibrateHips(defaultToReferenceMat, inputCalibration); @@ -666,10 +660,6 @@ void ViveControllerManager::InputDevice::calibrateShoulders(glm::mat4& defaultTo } } -void ViveControllerManager::InputDevice::calibrateHands(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration, - PuckPosePair firstHand, PuckPosePair secondHand) { -} - void ViveControllerManager::InputDevice::calibrateHead(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration) { int headIndex = _validTrackedObjects.size() - 1; } @@ -708,8 +698,6 @@ void ViveControllerManager::InputDevice::setConfigFromString(const QString& valu _preferedConfig = Config::FeetHipsAndChest; } else if (value == "FeetHipsAndShoulders") { _preferedConfig = Config::FeetHipsAndShoulders; - } else if (value == "FeetAndShoulders") { - _preferedConfig = Config::FeetAndShoulders; } } @@ -722,7 +710,7 @@ void ViveControllerManager::InputDevice::createPreferences() { auto getter = [this]()->QString { return _configStringMap[_preferedConfig]; }; auto setter = [this](const QString& value) { setConfigFromString(value); saveSettings(); }; auto preference = new ComboBoxPreference(VIVE_PUCKS_CONFIG, "Configuration", getter, setter); - QStringList list = (QStringList() << "Auto" << "Feet" << "FeetAndHips" << "FeetHipsAndChest" << "FeetAndShoulders"); + QStringList list = (QStringList() << "Auto" << "Feet" << "FeetAndHips" << "FeetHipsAndChest" << "FeetHipsAndShoulders"); preference->setItems(list); preferences->addPreference(preference); diff --git a/plugins/openvr/src/ViveControllerManager.h b/plugins/openvr/src/ViveControllerManager.h index 1fd11ccfe6..bc9558beaa 100644 --- a/plugins/openvr/src/ViveControllerManager.h +++ b/plugins/openvr/src/ViveControllerManager.h @@ -108,14 +108,11 @@ private: Auto, Head, Feet, - Hands, Shoulders, FeetAndHips, - FeetAndShoulders, FeetHipsAndChest, FeetHipsAndShoulders, - FeetHipsChestAndHands, - FeetHipsShouldersAndHands + FeetHipsChestAndHead }; Config _config { Config::Auto }; Config _preferedConfig { Config::Auto }; @@ -153,9 +150,6 @@ private: void calibrateHips(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration); void calibrateChest(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration); - void calibrateHands(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration, - PuckPosePair firstHand, PuckPosePair secondHand); - void calibrateShoulders(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration, int firstShoulderIndex, int secondShoulderIndex);