mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 03:24:46 +02:00
Derp, have to set the rotation after adjusting it.
This commit is contained in:
parent
4bf4accba7
commit
f5889934a2
1 changed files with 7 additions and 7 deletions
|
@ -141,13 +141,7 @@ void SkeletonModel::applyPalmData(int jointIndex, const QVector<int>& fingerJoin
|
|||
float sign = (jointIndex == geometry.rightHandJointIndex) ? 1.0f : -1.0f;
|
||||
glm::quat palmRotation = rotationBetween(_rotation * IDENTITY_UP, -palm.getNormal()) * _rotation *
|
||||
glm::angleAxis(90.0f, 0.0f, sign, 0.0f); // ninety degree rotation to face fingers forward from bind pose
|
||||
setJointRotation(jointIndex, palmRotation, true);
|
||||
|
||||
// no point in continuing if there are no fingers
|
||||
if (palm.getNumFingers() == 0 || fingerJointIndices.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// sort the finger indices by raw x, get the average direction
|
||||
QVector<IndexValue> fingerIndices;
|
||||
glm::vec3 direction;
|
||||
|
@ -165,9 +159,15 @@ void SkeletonModel::applyPalmData(int jointIndex, const QVector<int>& fingerJoin
|
|||
// rotate palm according to average finger direction
|
||||
float directionLength = glm::length(direction);
|
||||
if (directionLength > EPSILON) {
|
||||
palmRotation = rotationBetween(palmRotation * glm::vec3(sign, 0.0f, 0.0f), direction) * palmRotation;
|
||||
palmRotation = rotationBetween(palmRotation * glm::vec3(-sign, 0.0f, 0.0f), direction) * palmRotation;
|
||||
}
|
||||
setJointRotation(jointIndex, palmRotation, true);
|
||||
|
||||
// no point in continuing if there are no fingers
|
||||
if (palm.getNumFingers() == 0 || fingerJointIndices.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// match them up as best we can
|
||||
float proportion = fingerIndices.size() / (float)fingerJointIndices.size();
|
||||
for (int i = 0; i < fingerJointIndices.size(); i++) {
|
||||
|
|
Loading…
Reference in a new issue