Merge pull request #6190 from hyperlogic/tony/owen-ik-fix

Bug fix for hand IK when using the Owen avatar.
This commit is contained in:
Howard Stearns 2015-10-26 17:42:12 -07:00
commit 5e66207bc6
2 changed files with 4 additions and 1 deletions

View file

@ -366,7 +366,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars
if (offsetLength > MIN_HIPS_OFFSET_LENGTH) {
// but only if offset is long enough
float scaleFactor = ((offsetLength - MIN_HIPS_OFFSET_LENGTH) / offsetLength);
_relativePoses[0].trans = underPoses[0].trans + scaleFactor * _hipsOffset;
_relativePoses[_hipsIndex].trans = underPoses[_hipsIndex].trans + scaleFactor * _hipsOffset;
}
solveWithCyclicCoordinateDescent(targets);
@ -758,8 +758,10 @@ void AnimInverseKinematics::setSkeletonInternal(AnimSkeleton::ConstPointer skele
if (skeleton) {
initConstraints();
_headIndex = _skeleton->nameToJointIndex("Head");
_hipsIndex = _skeleton->nameToJointIndex("Hips");
} else {
clearConstraints();
_headIndex = -1;
_hipsIndex = -1;
}
}

View file

@ -80,6 +80,7 @@ protected:
// experimental data for moving hips during IK
int _headIndex = -1;
int _hipsIndex = -1;
glm::vec3 _hipsOffset = Vectors::ZERO;
// _maxTargetIndex is tracked to help optimize the recalculation of absolute poses