mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-05 22:43:13 +02:00
Merge pull request #10793 from druiz17/wide-stance-fix
MoCap wide stance fix for calibration
This commit is contained in:
commit
59e72470f3
2 changed files with 27 additions and 8 deletions
|
@ -959,15 +959,33 @@ void ViveControllerManager::InputDevice::calibrateFeet(glm::mat4& defaultToRefer
|
|||
controller::Pose& secondFootPose = secondFoot.second;
|
||||
|
||||
if (determineLimbOrdering(firstFootPose, secondFootPose, headXAxis, headPosition)) {
|
||||
_jointToPuckMap[controller::LEFT_FOOT] = firstFoot.first;
|
||||
_pucksOffset[firstFoot.first] = computeOffset(defaultToReferenceMat, inputCalibration.defaultLeftFoot, firstFootPose);
|
||||
_jointToPuckMap[controller::RIGHT_FOOT] = secondFoot.first;
|
||||
_pucksOffset[secondFoot.first] = computeOffset(defaultToReferenceMat, inputCalibration.defaultRightFoot, secondFootPose);
|
||||
calibrateFoot(defaultToReferenceMat, inputCalibration, firstFoot, true);
|
||||
calibrateFoot(defaultToReferenceMat, inputCalibration, secondFoot, false);
|
||||
} else {
|
||||
_jointToPuckMap[controller::LEFT_FOOT] = secondFoot.first;
|
||||
_pucksOffset[secondFoot.first] = computeOffset(defaultToReferenceMat, inputCalibration.defaultLeftFoot, secondFootPose);
|
||||
_jointToPuckMap[controller::RIGHT_FOOT] = firstFoot.first;
|
||||
_pucksOffset[firstFoot.first] = computeOffset(defaultToReferenceMat, inputCalibration.defaultRightFoot, firstFootPose);
|
||||
calibrateFoot(defaultToReferenceMat, inputCalibration, secondFoot, true);
|
||||
calibrateFoot(defaultToReferenceMat, inputCalibration, firstFoot, false);
|
||||
}
|
||||
}
|
||||
|
||||
void ViveControllerManager::InputDevice::calibrateFoot(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration, PuckPosePair& footPair, bool isLeftFoot){
|
||||
controller::Pose footPose = footPair.second;
|
||||
glm::mat4 puckPoseAvatarMat = createMatFromQuatAndPos(footPose.getRotation(), footPose.getTranslation());
|
||||
glm::mat4 defaultFoot = isLeftFoot ? inputCalibration.defaultLeftFoot : inputCalibration.defaultRightFoot;
|
||||
glm::mat4 footOffset = computeOffset(defaultToReferenceMat, defaultFoot, footPose);
|
||||
|
||||
glm::quat rotationOffset = glmExtractRotation(footOffset);
|
||||
glm::vec3 translationOffset = extractTranslation(footOffset);
|
||||
glm::vec3 avatarXAxisInPuckFrame = glm::normalize(transformVectorFast(glm::inverse(puckPoseAvatarMat), glm::vec3(-1.0f, 0.0f, 0.0f)));
|
||||
float distance = glm::dot(translationOffset, avatarXAxisInPuckFrame);
|
||||
glm::vec3 finalTranslation = translationOffset - (distance * avatarXAxisInPuckFrame);
|
||||
glm::mat4 finalOffset = createMatFromQuatAndPos(rotationOffset, finalTranslation);
|
||||
|
||||
if (isLeftFoot) {
|
||||
_jointToPuckMap[controller::LEFT_FOOT] = footPair.first;
|
||||
_pucksOffset[footPair.first] = finalOffset;
|
||||
} else {
|
||||
_jointToPuckMap[controller::RIGHT_FOOT] = footPair.first;
|
||||
_pucksOffset[footPair.first] = finalOffset;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ private:
|
|||
void calibrateLeftHand(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration, PuckPosePair& handPair);
|
||||
void calibrateRightHand(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration, PuckPosePair& handPair);
|
||||
void calibrateFeet(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration);
|
||||
void calibrateFoot(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration, PuckPosePair& footPair, bool isLeftFoot);
|
||||
void calibrateHips(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration);
|
||||
void calibrateChest(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration);
|
||||
void calibrateShoulders(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration,
|
||||
|
|
Loading…
Reference in a new issue