mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 10:37:35 +02:00
Fix for HMDHead tip constraint
This commit is contained in:
parent
1cd0f03242
commit
deca26e9eb
1 changed files with 5 additions and 4 deletions
|
@ -248,17 +248,18 @@ int AnimInverseKinematics::solveTargetWithCCD(const IKTarget& target, AnimPoseVe
|
||||||
glm::quat tipParentOrientation = absolutePoses[pivotIndex].rot();
|
glm::quat tipParentOrientation = absolutePoses[pivotIndex].rot();
|
||||||
|
|
||||||
if (targetType == IKTarget::Type::HmdHead) {
|
if (targetType == IKTarget::Type::HmdHead) {
|
||||||
|
|
||||||
// rotate tip directly to target orientation
|
// rotate tip directly to target orientation
|
||||||
tipOrientation = target.getRotation();
|
tipOrientation = target.getRotation();
|
||||||
glm::quat tipRelativeRotation = glm::normalize(tipOrientation * glm::inverse(tipParentOrientation));
|
glm::quat tipRelativeRotation = glm::inverse(tipParentOrientation) * tipOrientation;
|
||||||
|
|
||||||
// enforce tip's constraint
|
// then enforce tip's constraint
|
||||||
RotationConstraint* constraint = getConstraint(tipIndex);
|
RotationConstraint* constraint = getConstraint(tipIndex);
|
||||||
if (constraint) {
|
if (constraint) {
|
||||||
bool constrained = constraint->apply(tipRelativeRotation);
|
bool constrained = constraint->apply(tipRelativeRotation);
|
||||||
if (constrained) {
|
if (constrained) {
|
||||||
tipOrientation = glm::normalize(tipRelativeRotation * tipParentOrientation);
|
tipOrientation = tipParentOrientation * tipRelativeRotation;
|
||||||
tipRelativeRotation = glm::normalize(tipOrientation * glm::inverse(tipParentOrientation));
|
tipRelativeRotation = tipRelativeRotation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// store the relative rotation change in the accumulator
|
// store the relative rotation change in the accumulator
|
||||||
|
|
Loading…
Reference in a new issue