store rotations when interpolating

This commit is contained in:
luiscuenca 2019-08-09 11:02:20 -07:00
parent e3ec87a8f8
commit 73b3419c75
No known key found for this signature in database
GPG key ID: 2387ECD129A6961D

View file

@ -362,12 +362,12 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector<
_relativePoses[tipIndex].rot() = safeMix(_relativePoses[tipIndex].rot(), newRelativeRotation, alpha);
} else {
_relativePoses[tipIndex].rot() = newRelativeRotation;
// Add last known rotations to interpolate from
if (_rotationOnlyIKRotations.find(tipIndex) == _rotationOnlyIKRotations.end()) {
_rotationOnlyIKRotations.insert(std::pair<int, glm::quat>(tipIndex, newRelativeRotation));
} else {
_rotationOnlyIKRotations[tipIndex] = newRelativeRotation;
}
}
// Add last known rotations to interpolate from
if (_rotationOnlyIKRotations.find(tipIndex) == _rotationOnlyIKRotations.end()) {
_rotationOnlyIKRotations.insert(std::pair<int, glm::quat>(tipIndex, _relativePoses[tipIndex].rot()));
} else {
_rotationOnlyIKRotations[tipIndex] = _relativePoses[tipIndex].rot();
}
absolutePoses[tipIndex].rot() = targetRotation;
} else {