This commit is contained in:
Erimel authored and GitHub committed 2023-02-23 00:45:53 +03:00
1 parent cd5c4dc219
commit 020ee98e47
1 file changed
+4 -2
@@ -1177,16 +1177,18 @@ public class HumanSkeleton {
) {
// Clone the hip since we're modifying it and returning it
hip = hip.clone();
// Clone the knees here because otherwise it doesn't work because Java
leftKnee = leftKnee.clone();
rightKnee = rightKnee.clone();
// Get the knees' rotation relative to where we expect them to be.
// The angle between your knees and hip can be over 180 degrees...
hip.mult(FORWARD_QUATERNION, rotBuf1);
if (rotBuf1.dot(leftKnee) < 0.0f) {
leftKnee = leftKnee.clone();
leftKnee.negateLocal();
}
if (rotBuf1.dot(rightKnee) < 0.0f) {
rightKnee = rightKnee.clone();
rightKnee.negateLocal();
}