From 11fedb23cde5dee67d684702d1692d3b13281190 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Thu, 7 Nov 2013 17:51:54 -0800 Subject: [PATCH] Try finding the fingers using the rotation about the palm. --- interface/src/avatar/SkeletonModel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/interface/src/avatar/SkeletonModel.cpp b/interface/src/avatar/SkeletonModel.cpp index 9e0548fe17..92b9f7aada 100644 --- a/interface/src/avatar/SkeletonModel.cpp +++ b/interface/src/avatar/SkeletonModel.cpp @@ -146,12 +146,13 @@ void SkeletonModel::applyPalmData(int jointIndex, const QVector& fingerJoin QVector fingerIndices; glm::vec3 direction; for (int i = 0; i < palm.getNumFingers(); i++) { - glm::vec3 fingerVector = palm.getFingers()[i].getTipPosition() - palm.getFingers()[i].getRootPosition(); + glm::vec3 fingerVector = palm.getFingers()[i].getTipPosition() - palm.getPosition(); float length = glm::length(fingerVector); if (length > EPSILON) { direction += fingerVector / length; } - IndexValue indexValue = { i, palm.getFingers()[i].getTipRawPosition().x }; + fingerVector = glm::inverse(palmRotation) * fingerVector; + IndexValue indexValue = { i, atan2f(fingerVector.z, fingerVector.x) }; fingerIndices.append(indexValue); } qSort(fingerIndices.begin(), fingerIndices.end());