mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-14 11:46:34 +02:00
AnimInverseKinematics: use glm::clamp for clarity.
This commit is contained in:
parent
b5a72225db
commit
2d1304e070
1 changed files with 1 additions and 1 deletions
|
@ -278,7 +278,7 @@ int AnimInverseKinematics::solveTargetWithCCD(const IKTarget& target, AnimPoseVe
|
|||
if (axisLength > MIN_AXIS_LENGTH) {
|
||||
// compute angle of rotation that brings tip closer to target
|
||||
axis /= axisLength;
|
||||
float cosAngle = std::min(std::max(glm::dot(leverArm, targetLine) / (glm::length(leverArm) * glm::length(targetLine)), -1.0f), 1.0f);
|
||||
float cosAngle = glm::clamp(glm::dot(leverArm, targetLine) / (glm::length(leverArm) * glm::length(targetLine)), -1.0f, 1.0f);
|
||||
float angle = acosf(cosAngle);
|
||||
const float MIN_ADJUSTMENT_ANGLE = 1.0e-4f;
|
||||
if (angle > MIN_ADJUSTMENT_ANGLE) {
|
||||
|
|
Loading…
Reference in a new issue