From e03368414e1196a5809cf87297ad0acd8150be8b Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 27 Feb 2017 18:57:44 -0800 Subject: [PATCH] CR --- .../animation/src/AnimInverseKinematics.cpp | 18 +++--------------- .../animation/src/AnimInverseKinematics.h | 1 - 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index 1eda4db2c0..173af3fdf6 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -489,7 +489,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars // by looking for discrepancies between where a targeted endEffector is // and where it wants to be (after IK solutions are done) - // OUTOFBODY_HACK:use weighted average between HMD and other targets + // use weighted average between HMD and other targets float HMD_WEIGHT = 10.0f; float OTHER_WEIGHT = 1.0f; float totalWeight = 0.0f; @@ -542,7 +542,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars float tau = dt < HIPS_OFFSET_SLAVE_TIMESCALE ? dt / HIPS_OFFSET_SLAVE_TIMESCALE : 1.0f; _hipsOffset += additionalHipsOffset * tau; - // clamp the horizontal component of the hips offset + // clamp the hips offset float hipsOffsetLength = glm::length(_hipsOffset); if (hipsOffsetLength > _maxHipsOffsetLength) { _hipsOffset *= _maxHipsOffsetLength / hipsOffsetLength; @@ -555,7 +555,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars } void AnimInverseKinematics::setMaxHipsOffsetLength(float maxLength) { - // OUTOFBODY_HACK: manually adjust scale here + // manually adjust scale here const float METERS_TO_CENTIMETERS = 100.0f; _maxHipsOffsetLength = METERS_TO_CENTIMETERS * maxLength; } @@ -938,22 +938,10 @@ void AnimInverseKinematics::setSkeletonInternal(AnimSkeleton::ConstPointer skele } else { _hipsParentIndex = -1; } - - auto currentJointIndex = _headIndex; - auto parentJointIndex = _skeleton->getParentIndex(currentJointIndex); - _spineLength = 0.0f; - while (currentJointIndex != _hipsIndex && parentJointIndex != -1) { - _spineLength += glm::distance(_skeleton->getAbsoluteDefaultPose(currentJointIndex).trans(), - _skeleton->getAbsoluteDefaultPose(parentJointIndex).trans()); - - currentJointIndex = parentJointIndex; - parentJointIndex = _skeleton->getParentIndex(currentJointIndex); - } } else { clearConstraints(); _headIndex = -1; _hipsIndex = -1; _hipsParentIndex = -1; - _spineLength = 0.0f; } } diff --git a/libraries/animation/src/AnimInverseKinematics.h b/libraries/animation/src/AnimInverseKinematics.h index ad5018b0b8..892a5616b2 100644 --- a/libraries/animation/src/AnimInverseKinematics.h +++ b/libraries/animation/src/AnimInverseKinematics.h @@ -91,7 +91,6 @@ protected: int _headIndex { -1 }; int _hipsIndex { -1 }; int _hipsParentIndex { -1 }; - float _spineLength { 0.0f }; // _maxTargetIndex is tracked to help optimize the recalculation of absolute poses // during the the cyclic coordinate descent algorithm