Showing the changes to interface/src/scripting/HMDScriptingInterface.cpp (1 of 81 files). Show all
Unified · Split
| @@ -159,6 +159,27 @@ bool HMDScriptingInterface::setHandLasers(int hands, bool enabled, const glm::ve · 158 unmodified lines | ||
| 159 | 159 | color, direction); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | +bool HMDScriptingInterface::setExtraLaser(const glm::vec3& worldStart, bool enabled, const glm::vec4& color, const glm::vec3& direction) const { | |
| 163 | + auto offscreenUi = DependencyManager::get<OffscreenUi>(); | |
| 164 | + offscreenUi->executeOnUiThread([offscreenUi, enabled] { | |
| 165 | + offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", enabled); | |
| 166 | + }); | |
| 167 | + | |
| 168 | + | |
| 169 | + auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); | |
| 170 | + auto sensorToWorld = myAvatar->getSensorToWorldMatrix(); | |
| 171 | + auto worldToSensor = glm::inverse(sensorToWorld); | |
| 172 | + auto sensorStart = ::transformPoint(worldToSensor, worldStart); | |
| 173 | + auto sensorDirection = ::transformVectorFast(worldToSensor, direction); | |
| 174 | + | |
| 175 | + return qApp->getActiveDisplayPlugin()->setExtraLaser(enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None, | |
| 176 | + color, sensorStart, sensorDirection); | |
| 177 | +} | |
| 178 | + | |
| 179 | +void HMDScriptingInterface::disableExtraLaser() const { | |
| 180 | + setExtraLaser(vec3(0), false, vec4(0), vec3(0)); | |
| 181 | +} | |
| 182 | + | |
| 162 | 183 | void HMDScriptingInterface::disableHandLasers(int hands) const { |
| 163 | 184 | setHandLasers(hands, false, vec4(0), vec3(0)); |
| 164 | 185 | } |