History

Made it so you can only select in a 180 degree radius with oculus

barnold1953 committed 12 years ago

Commit d044af11 parent b5a9f502 files · +11 −6Browse files

Showing the changes to interface/src/ui/ApplicationOverlay.cpp (1 of 2 files). Show all

Unified · Split

interface/src/ui/ApplicationOverlay.cpp+10−4
@@ -290,12 +290,18 @@ QPoint ApplicationOverlay::getOculusPalmClickLocation(PalmData *palm) const { · 289 unmodified lines
290 if (raySphereIntersect(dir, adjustedPos, 1, &t)){290 if (raySphereIntersect(dir, adjustedPos, 1, &t)){
291 glm::vec3 collisionPos = adjustedPos + dir * t;291 glm::vec3 collisionPos = adjustedPos + dir * t;
292 292
293 float u = asin(collisionPos.x) / (_textureFov)+0.5f;293 //If we hit the back hemisphere, mark it as not a collision
294 float v = 1.0 - (asin(collisionPos.y) / (_textureFov)+0.5f);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());299 float u = asin(collisionPos.x) / (_textureFov)+0.5f;
297 rv.setY(v * glWidget->height());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 } else {305 } else {
300 //if they did not click on the overlay, just set the coords to INT_MAX306 //if they did not click on the overlay, just set the coords to INT_MAX
301 rv.setX(INT_MAX);307 rv.setX(INT_MAX);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t