mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:16:51 +02:00
Fix transform computation
This commit is contained in:
parent
0440e2fd60
commit
e503542b6a
1 changed files with 6 additions and 6 deletions
|
@ -2481,21 +2481,21 @@ bool MyAvatar::pinJoint(int index, const glm::vec3& position, const glm::quat& o
|
||||||
qWarning() << "Pinning is only supported for the hips joint at the moment.";
|
qWarning() << "Pinning is only supported for the hips joint at the moment.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
qApp->getActiveDisplayPlugin()->resetSensors();
|
||||||
|
|
||||||
auto jointTranslation = getAbsoluteJointTranslationInObjectFrame(index);
|
auto jointTranslation = getAbsoluteJointTranslationInObjectFrame(index);
|
||||||
auto jointRotation = getAbsoluteJointRotationInObjectFrame(index);
|
auto jointRotation = getAbsoluteJointRotationInObjectFrame(index);
|
||||||
|
|
||||||
Transform final(orientation, Vectors::ONE, position);
|
auto targetOrientation = orientation * glm::conjugate(glm::normalize(jointRotation));
|
||||||
Transform joint(jointRotation, Vectors::ONE, jointTranslation);
|
auto targetPosition = position - orientation * jointTranslation;
|
||||||
|
|
||||||
Transform avatarTransform(final.getMatrix() * joint.getInverseMatrix());
|
setPosition(targetPosition);
|
||||||
setPosition(avatarTransform.getTranslation());
|
setOrientation(targetOrientation);
|
||||||
setOrientation(avatarTransform.getRotation());
|
|
||||||
|
|
||||||
_rig->setMaxHipsOffsetLength(0.0f);
|
_rig->setMaxHipsOffsetLength(0.0f);
|
||||||
|
|
||||||
auto it = std::find(_pinnedJoints.begin(), _pinnedJoints.end(), index);
|
auto it = std::find(_pinnedJoints.begin(), _pinnedJoints.end(), index);
|
||||||
if (it != _pinnedJoints.end()) {
|
if (it == _pinnedJoints.end()) {
|
||||||
_pinnedJoints.push_back(index);
|
_pinnedJoints.push_back(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue