Showing the changes to interface/src/ui/ApplicationOverlay.cpp (1 of 2 files). Show all
Unified · Split
| @@ -290,12 +290,18 @@ QPoint ApplicationOverlay::getOculusPalmClickLocation(PalmData *palm) const { · 289 unmodified lines | ||
| 290 | 290 | if (raySphereIntersect(dir, adjustedPos, 1, &t)){ |
| 291 | 291 | glm::vec3 collisionPos = adjustedPos + dir * t; |
| 292 | 292 | |
| 293 | − float u = asin(collisionPos.x) / (_textureFov)+0.5f; | |
| 294 | − float v = 1.0 - (asin(collisionPos.y) / (_textureFov)+0.5f); | |
| 293 | + //If we hit the back hemisphere, mark it as not a collision | |
| 294 | + if (collisionPos.z > 0) { | |
| 295 | + rv.setX(INT_MAX); | |
| 296 | + rv.setY(INT_MAX); | |
| 297 | + } else { | |
| 295 | 298 | |
| 296 | − rv.setX(u * glWidget->width()); | |
| 297 | − rv.setY(v * glWidget->height()); | |
| 299 | + float u = asin(collisionPos.x) / (_textureFov)+0.5f; | |
| 300 | + float v = 1.0 - (asin(collisionPos.y) / (_textureFov)+0.5f); | |
| 298 | 301 | |
| 302 | + rv.setX(u * glWidget->width()); | |
| 303 | + rv.setY(v * glWidget->height()); | |
| 304 | + } | |
| 299 | 305 | } else { |
| 300 | 306 | //if they did not click on the overlay, just set the coords to INT_MAX |
| 301 | 307 | rv.setX(INT_MAX); |