diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index 17a1af1969..516d4116d8 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -255,7 +255,7 @@ void AnimInverseKinematics::solveWithCyclicCoordinateDescent(const std::vector -void RotationAccumulator::add(const glm::quat& rotation) { +void RotationAccumulator::add(const glm::quat& rotation, float weight) { // make sure both quaternions are on the same hyper-hemisphere before we add them linearly (lerp) - _rotationSum += copysignf(1.0f, glm::dot(_rotationSum, rotation)) * rotation; + _rotationSum += copysignf(weight, glm::dot(_rotationSum, rotation)) * rotation; ++_numRotations; _isDirty = true; } diff --git a/libraries/animation/src/RotationAccumulator.h b/libraries/animation/src/RotationAccumulator.h index 87b1a753c9..a113b086f9 100644 --- a/libraries/animation/src/RotationAccumulator.h +++ b/libraries/animation/src/RotationAccumulator.h @@ -18,7 +18,9 @@ public: int size() const { return _numRotations; } - void add(const glm::quat& rotation); + /// \param rotation rotation to add + /// \param weight contribution factor of this rotation to total accumulation + void add(const glm::quat& rotation, float weight = 1.0f); glm::quat getAverage();