mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 18:44:00 +02:00
Merge pull request #2871 from ey6es/master
Better rotations with alternate IK.
This commit is contained in:
commit
31455e6cb0
1 changed files with 4 additions and 6 deletions
|
@ -334,13 +334,11 @@ void SkeletonModel::setHandPosition(int jointIndex, const glm::vec3& position, c
|
|||
|
||||
glm::vec3 forwardVector(rightHand ? -1.0f : 1.0f, 0.0f, 0.0f);
|
||||
|
||||
glm::quat shoulderRotation;
|
||||
getJointRotation(shoulderJointIndex, shoulderRotation, true);
|
||||
applyRotationDelta(shoulderJointIndex, rotationBetween(shoulderRotation * forwardVector, elbowPosition - shoulderPosition), false);
|
||||
glm::quat shoulderRotation = rotationBetween(forwardVector, elbowPosition - shoulderPosition);
|
||||
setJointRotation(shoulderJointIndex, shoulderRotation, true);
|
||||
|
||||
glm::quat elbowRotation;
|
||||
getJointRotation(elbowJointIndex, elbowRotation, true);
|
||||
applyRotationDelta(elbowJointIndex, rotationBetween(elbowRotation * forwardVector, wristPosition - elbowPosition), false);
|
||||
setJointRotation(elbowJointIndex, rotationBetween(shoulderRotation * forwardVector,
|
||||
wristPosition - elbowPosition) * shoulderRotation, true);
|
||||
|
||||
setJointRotation(jointIndex, rotation, true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue