diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index b2a3ecbedb..06f36afe52 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -711,17 +711,19 @@ glm::vec3 MyAvatar::getUprightHeadPosition() const { return _position + getWorldAlignedOrientation() * glm::vec3(0.0f, getPelvisToHeadLength(), 0.0f); } +const float JOINT_PRIORITY = 2.0f; + void MyAvatar::setJointData(int index, const glm::quat& rotation) { Avatar::setJointData(index, rotation); if (QThread::currentThread() == thread()) { - _skeletonModel.setJointState(index, true, rotation, 2.0f); + _skeletonModel.setJointState(index, true, rotation, JOINT_PRIORITY); } } void MyAvatar::clearJointData(int index) { Avatar::clearJointData(index); if (QThread::currentThread() == thread()) { - _skeletonModel.setJointState(index, false, glm::quat(), 2.0f); + _skeletonModel.setJointState(index, false, glm::quat(), JOINT_PRIORITY); } } diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index 835c8fd901..636f66fa16 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -1681,7 +1681,7 @@ void AnimationHandle::setURL(const QUrl& url) { static void insertSorted(QList& handles, const AnimationHandlePointer& handle) { for (QList::iterator it = handles.begin(); it != handles.end(); it++) { - if (handle->getPriority() < (*it)->getPriority()) { + if (handle->getPriority() > (*it)->getPriority()) { handles.insert(it, handle); return; } @@ -1713,6 +1713,15 @@ void AnimationHandle::setRunning(bool running) { } else { _model->_runningAnimations.removeOne(_self); + for (int i = 0; i < _jointMappings.size(); i++) { + int mapping = _jointMappings.at(i); + if (mapping != -1) { + Model::JointState& state = _model->_jointStates[mapping]; + if (_priority == state.animationPriority) { + state.animationPriority = 0.0f; + } + } + } } }