Showing the changes to interface/src/scripting/HMDScriptingInterface.cpp (1 of 8 files). Show all
Unified · Split
| @@ -130,16 +130,26 @@ bool HMDScriptingInterface::setHandLasers(int hands, bool enabled, const glm::ve · 129 unmodified lines | |||
| 130 | color, direction); | 130 | color, direction); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | bool HMDScriptingInterface::setExtraLaser(const vec3& worldStart, bool enabled, const vec4& color, const vec3& direction) const { | 133 | bool HMDScriptingInterface::setExtraLaser(const glm::vec3& worldStart, bool enabled, const glm::vec4& color, const glm::vec3& direction) const { |
| 134 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); | 134 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 135 | offscreenUi->executeOnUiThread([offscreenUi, enabled] { | 135 | offscreenUi->executeOnUiThread([offscreenUi, enabled] { |
| 136 | offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", enabled); | 136 | offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", enabled); |
| 137 | }); | 137 | }); |
| 138 | 138 | ||
| 139 | mat4 extraLaserPose; | 139 | |
| 140 | return qApp->getActiveDisplayPlugin()->setExtraLaser(extraLaserPose, | 140 | auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); |
| 141 | enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None, | 141 | auto sensorToWorld = myAvatar->getSensorToWorldMatrix(); |
| 142 | color, direction); | 142 | auto worldToSensor = glm::inverse(sensorToWorld); |
| 143 | auto sensorStart = ::transformPoint(worldToSensor, worldStart); | ||
| 144 | auto sensorDirection = ::transformVectorFast(worldToSensor, direction); // wrong | ||
| 145 | |||
| 146 | qDebug() << __FUNCTION__ << "worldStart:" << worldStart << "sensorStart:" << sensorStart; | ||
| 147 | qDebug() << __FUNCTION__ << "direction:" << direction << "sensorDirection:" << sensorDirection; | ||
| 148 | qDebug() << __FUNCTION__ << "enabled:" << enabled; | ||
| 149 | |||
| 150 | |||
| 151 | return qApp->getActiveDisplayPlugin()->setExtraLaser(enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None, | ||
| 152 | color, sensorStart, sensorDirection); | ||
| 143 | } | 153 | } |
| 144 | 154 | ||
| 145 | void HMDScriptingInterface::disableExtraLaser() const { | 155 | void HMDScriptingInterface::disableExtraLaser() const { |