mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 05:43:36 +02:00
Improved rotation computation.
This commit is contained in:
parent
391b62ed32
commit
69dd4ff59b
3 changed files with 7 additions and 3 deletions
|
@ -1082,7 +1082,9 @@ void Avatar::updateBodyBalls(float deltaTime) {
|
||||||
if (_skeleton.joint[b].parent == AVATAR_JOINT_NULL || length < SMALL_SPRING_LENGTH) {
|
if (_skeleton.joint[b].parent == AVATAR_JOINT_NULL || length < SMALL_SPRING_LENGTH) {
|
||||||
_bodyBall[b].rotation = orientation * _skeleton.joint[_bodyBall[b].parentJoint].absoluteBindPoseRotation;
|
_bodyBall[b].rotation = orientation * _skeleton.joint[_bodyBall[b].parentJoint].absoluteBindPoseRotation;
|
||||||
} else {
|
} else {
|
||||||
_bodyBall[b].rotation = rotationBetween(jointDirection, springVector) * orientation;
|
glm::vec3 parentDirection = _bodyBall[ _skeleton.joint[b].parent ].rotation * JOINT_DIRECTION;
|
||||||
|
_bodyBall[b].rotation = rotationBetween(parentDirection, springVector) *
|
||||||
|
_bodyBall[ _skeleton.joint[b].parent ].rotation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,9 @@ void Skeleton::initialize() {
|
||||||
} else {
|
} else {
|
||||||
joint[b].absoluteBindPosePosition = joint[ joint[b].parent ].absoluteBindPosePosition +
|
joint[b].absoluteBindPosePosition = joint[ joint[b].parent ].absoluteBindPosePosition +
|
||||||
joint[b].bindPosePosition;
|
joint[b].bindPosePosition;
|
||||||
joint[b].absoluteBindPoseRotation = rotationBetween(JOINT_DIRECTION, joint[b].bindPosePosition);
|
glm::vec3 parentDirection = joint[ joint[b].parent ].absoluteBindPoseRotation * JOINT_DIRECTION;
|
||||||
|
joint[b].absoluteBindPoseRotation = rotationBetween(parentDirection, joint[b].bindPosePosition) *
|
||||||
|
joint[ joint[b].parent ].absoluteBindPoseRotation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ enum AvatarJointID
|
||||||
NUM_AVATAR_JOINTS
|
NUM_AVATAR_JOINTS
|
||||||
};
|
};
|
||||||
|
|
||||||
const glm::vec3 JOINT_DIRECTION = glm::vec3(1.0f, 0.0f, 0.0f);
|
const glm::vec3 JOINT_DIRECTION = glm::vec3(0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
class Skeleton {
|
class Skeleton {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue