From 0f51236fb06103773c8a0aac3210f95b9ad17506 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Wed, 21 Jun 2017 14:36:42 -0700 Subject: [PATCH] Rig.cpp: take avatar scale into account when computing elbow pole vector --- libraries/animation/src/Rig.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index ef5bd3c032..51480e8ef1 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -1383,8 +1383,10 @@ glm::vec3 Rig::calculateElbowPoleVector(int handIndex, int elbowIndex, int armIn glm::vec3 y = hipsPose.rot() * Vectors::UNIT_Y; // project d onto n. glm::vec3 dProj = d - glm::dot(d, n) * n; - const float LATERAL_OFFSET = 0.333f; - const float VERTICAL_OFFSET = -0.333f; + + float avatarScale = extractUniformScale(_modelOffset); + const float LATERAL_OFFSET = 0.333f * avatarScale; + const float VERTICAL_OFFSET = -0.333f * avatarScale; // give dProj a bit of offset away from the body. glm::vec3 dProjWithOffset = dProj + sign * LATERAL_OFFSET * n + y * VERTICAL_OFFSET;