Merge pull request #12655 from hyperlogic/bug-fix/hand-ik-glitch

Fix for hand IK jitter
This commit is contained in:
John Conklin II 2018-03-16 10:43:16 -07:00 committed by GitHub
commit 652ca98ebf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,16 +66,12 @@ bool ElbowConstraint::apply(glm::quat& rotation) const {
bool twistWasClamped = (twistAngle != clampedTwistAngle);
// update rotation
const float MIN_SWING_REAL_PART = 0.99999f;
if (twistWasClamped || fabsf(swingRotation.w) < MIN_SWING_REAL_PART) {
if (twistWasClamped) {
twistRotation = glm::angleAxis(clampedTwistAngle, _axis);
}
// we discard all swing and only keep twist
rotation = twistRotation * _referenceRotation;
return true;
if (twistWasClamped) {
twistRotation = glm::angleAxis(clampedTwistAngle, _axis);
}
return false;
// we discard all swing and only keep twist
rotation = twistRotation * _referenceRotation;
return true;
}
glm::quat ElbowConstraint::computeCenterRotation() const {