This reverts commit efe9571ab82b3b70877b0140c70a37307c5a39dd, reversing changes made to 333e9ec7f4111a9fe4b0d6b7a6a80b56b8ca00fd.
Showing the changes to interface/src/scripting/HMDScriptingInterface.cpp (1 of 63 files). Show all
Unified · Split
| @@ -114,21 +114,6 @@ glm::vec3 HMDScriptingInterface::getPosition() const { · 113 unmodified lines | |||
| 114 | return glm::vec3(); | 114 | return glm::vec3(); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | void HMDScriptingInterface::setPosition(const glm::vec3& position) { | ||
| 118 | if (QThread::currentThread() != thread()) { | ||
| 119 | QMetaObject::invokeMethod(this, "setPosition", Qt::QueuedConnection, Q_ARG(const glm::vec3&, position)); | ||
| 120 | return; | ||
| 121 | } else { | ||
| 122 | auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); | ||
| 123 | glm::mat4 hmdToSensor = myAvatar->getHMDSensorMatrix(); | ||
| 124 | glm::mat4 sensorToWorld = myAvatar->getSensorToWorldMatrix(); | ||
| 125 | glm::mat4 hmdToWorld = sensorToWorld * hmdToSensor; | ||
| 126 | setTranslation(hmdToWorld, position); | ||
| 127 | sensorToWorld = hmdToWorld * glm::inverse(hmdToSensor); | ||
| 128 | myAvatar->setSensorToWorldMatrix(sensorToWorld); | ||
| 129 | } | ||
| 130 | } | ||
| 131 | |||
| 132 | glm::quat HMDScriptingInterface::getOrientation() const { | 117 | glm::quat HMDScriptingInterface::getOrientation() const { |
| 133 | if (qApp->getActiveDisplayPlugin()->isHmd()) { | 118 | if (qApp->getActiveDisplayPlugin()->isHmd()) { |
| 134 | return glm::normalize(glm::quat_cast(getWorldHMDMatrix())); | 119 | return glm::normalize(glm::quat_cast(getWorldHMDMatrix())); |
| @@ -199,8 +184,3 @@ bool HMDScriptingInterface::isKeyboardVisible() { · 64 unmodified lines | |||
| 199 | void HMDScriptingInterface::centerUI() { | 184 | void HMDScriptingInterface::centerUI() { |
| 200 | QMetaObject::invokeMethod(qApp, "centerUI", Qt::QueuedConnection); | 185 | QMetaObject::invokeMethod(qApp, "centerUI", Qt::QueuedConnection); |
| 201 | } | 186 | } |
| 202 | |||
| 203 | void HMDScriptingInterface::snapToAvatar() { | ||
| 204 | auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); | ||
| 205 | myAvatar->updateSensorToWorldMatrix(); | ||
| 206 | } | ||