diff --git a/examples/editModels.js b/examples/editModels.js index d07ca4c282..1db6901e23 100644 --- a/examples/editModels.js +++ b/examples/editModels.js @@ -88,7 +88,7 @@ function controller(wichSide) { this.oldModelPosition; this.oldModelRadius; - this.jointsIntersectingFronStart = []; + this.jointsIntersectingFromStart = []; this.laser = Overlays.addOverlay("line3d", { position: { x: 0, y: 0, z: 0 }, @@ -145,11 +145,11 @@ function controller(wichSide) { this.oldModelRotation = properties.modelRotation; this.oldModelRadius = properties.radius; - this.jointsIntersectingFronStart = []; + this.jointsIntersectingFromStart = []; for (var i = 0; i < jointList.length; i++) { var distance = Vec3.distance(MyAvatar.getJointPosition(jointList[i]), this.oldModelPosition); if (distance < this.oldModelRadius) { - this.jointsIntersectingFronStart.push(i); + this.jointsIntersectingFromStart.push(i); } } } @@ -176,7 +176,7 @@ function controller(wichSide) { if (closestJointDistance < this.oldModelRadius) { - if (this.jointsIntersectingFronStart.indexOf(closestJointIndex) != -1) { + if (this.jointsIntersectingFromStart.indexOf(closestJointIndex) != -1) { // Do nothing } else { print("Attaching to " + jointList[closestJointIndex]); @@ -197,7 +197,7 @@ function controller(wichSide) { this.grabbing = false; this.modelID.isKnownID = false; - this.jointsIntersectingFronStart = []; + this.jointsIntersectingFromStart = []; } this.checkTrigger = function () { diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index ac6718dcc8..870d5b1a53 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -706,24 +706,48 @@ QStringList Avatar::getJointNames() const { } glm::vec3 Avatar::getJointPosition(int index) const { - glm::vec3 position(0,0,0); + if (QThread::currentThread() != thread()) { + glm::vec3 position; + QMetaObject::invokeMethod(const_cast(this), "getJointPosition", Qt::BlockingQueuedConnection, + Q_RETURN_ARG(glm::vec3, position), Q_ARG(const int, index)); + return position; + } + glm::vec3 position; _skeletonModel.getJointPosition(index, position); return position; } glm::vec3 Avatar::getJointPosition(const QString& name) const { - glm::vec3 position(0,0,0); + if (QThread::currentThread() != thread()) { + glm::vec3 position; + QMetaObject::invokeMethod(const_cast(this), "getJointPosition", Qt::BlockingQueuedConnection, + Q_RETURN_ARG(glm::vec3, position), Q_ARG(const QString&, name)); + return position; + } + glm::vec3 position; _skeletonModel.getJointPosition(getJointIndex(name), position); return position; } glm::quat Avatar::getJointCombinedRotation(int index) const { + if (QThread::currentThread() != thread()) { + glm::quat rotation; + QMetaObject::invokeMethod(const_cast(this), "getJointCombinedRotation", Qt::BlockingQueuedConnection, + Q_RETURN_ARG(glm::quat, rotation), Q_ARG(const int, index)); + return rotation; + } glm::quat rotation; _skeletonModel.getJointCombinedRotation(index, rotation); return rotation; } glm::quat Avatar::getJointCombinedRotation(const QString& name) const { + if (QThread::currentThread() != thread()) { + glm::quat rotation; + QMetaObject::invokeMethod(const_cast(this), "getJointCombinedRotation", Qt::BlockingQueuedConnection, + Q_RETURN_ARG(glm::quat, rotation), Q_ARG(const QString&, name)); + return rotation; + } glm::quat rotation; _skeletonModel.getJointCombinedRotation(getJointIndex(name), rotation); return rotation; diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index b41d440e16..ee774c183a 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -634,8 +634,8 @@ bool Model::getJointRotation(int jointIndex, glm::quat& rotation, bool fromBind) return false; } rotation = _jointStates[jointIndex]._combinedRotation * - (fromBind ? _geometry->getFBXGeometry().joints[jointIndex].inverseBindRotation : - _geometry->getFBXGeometry().joints[jointIndex].inverseDefaultRotation); + (fromBind ? _geometry->getFBXGeometry().joints[jointIndex].inverseBindRotation : + _geometry->getFBXGeometry().joints[jointIndex].inverseDefaultRotation); return true; }