From df7ca3bc3886aeda3e98ddc3dfa9ed8a8cd375d8 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Fri, 20 Nov 2015 10:36:40 -0800 Subject: [PATCH] Rig: getJointRotation and getJointTranslation use _relativePoses --- libraries/animation/src/Rig.cpp | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index b5bde1b8c3..4f344ae4ea 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -444,19 +444,38 @@ bool Rig::getJointRotationInWorldFrame(int jointIndex, glm::quat& result, const // Deprecated. // WARNING: this is not symmetric with setJointRotation. It's historical. Use the appropriate specific variation. bool Rig::getJointRotation(int jointIndex, glm::quat& rotation) const { - if (jointIndex == -1 || jointIndex >= _jointStates.size()) { + + // AJT: LEGACY + { + if (jointIndex == -1 || jointIndex >= _jointStates.size()) { + return false; + } + rotation = _jointStates[jointIndex].getRotation(); + } + + if (jointIndex >= 0 && jointIndex < _relativePoses.size()) { + rotation = _relativePoses[jointIndex].rot; + return true; + } else { return false; } - rotation = _jointStates[jointIndex].getRotation(); - return true; } bool Rig::getJointTranslation(int jointIndex, glm::vec3& translation) const { - if (jointIndex == -1 || jointIndex >= _jointStates.size()) { + // AJT: LEGACY + { + if (jointIndex == -1 || jointIndex >= _jointStates.size()) { + return false; + } + translation = _jointStates[jointIndex].getTranslation(); + } + + if (jointIndex >= 0 && jointIndex < _relativePoses.size()) { + translation = _relativePoses[jointIndex].trans; + return true; + } else { return false; } - translation = _jointStates[jointIndex].getTranslation(); - return true; } bool Rig::getJointCombinedRotation(int jointIndex, glm::quat& result, const glm::quat& rotation) const {