mirror of
https://github.com/overte-org/overte.git
synced 2025-04-17 08:56:36 +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.";
|
||||
return false;
|
||||
}
|
||||
qApp->getActiveDisplayPlugin()->resetSensors();
|
||||
|
||||
auto jointTranslation = getAbsoluteJointTranslationInObjectFrame(index);
|
||||
auto jointRotation = getAbsoluteJointRotationInObjectFrame(index);
|
||||
|
||||
Transform final(orientation, Vectors::ONE, position);
|
||||
Transform joint(jointRotation, Vectors::ONE, jointTranslation);
|
||||
auto targetOrientation = orientation * glm::conjugate(glm::normalize(jointRotation));
|
||||
auto targetPosition = position - orientation * jointTranslation;
|
||||
|
||||
Transform avatarTransform(final.getMatrix() * joint.getInverseMatrix());
|
||||
setPosition(avatarTransform.getTranslation());
|
||||
setOrientation(avatarTransform.getRotation());
|
||||
setPosition(targetPosition);
|
||||
setOrientation(targetOrientation);
|
||||
|
||||
_rig->setMaxHipsOffsetLength(0.0f);
|
||||
|
||||
auto it = std::find(_pinnedJoints.begin(), _pinnedJoints.end(), index);
|
||||
if (it != _pinnedJoints.end()) {
|
||||
if (it == _pinnedJoints.end()) {
|
||||
_pinnedJoints.push_back(index);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue