diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gameMainWindow.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/ui/gameMainWindow.cpp b/ui/gameMainWindow.cpp index d53db4b..1724927 100644 --- a/ui/gameMainWindow.cpp +++ b/ui/gameMainWindow.cpp @@ -70,16 +70,11 @@ public: const auto & ref = *selected.base()->get(); clicked = typeid(ref).name(); } + else if (const auto pos = gameState->geoData->intersectRay(ray)) { + clicked = streamed_string(*pos); + } else { - try { - const auto dist = camera->pos.z / -ray.direction.z; - const auto pos = !camera->pos + (!ray.direction * dist); - - clicked = streamed_string(gameState->geoData->positionAt(pos)); - } - catch (std::range_error &) { - clicked.clear(); - } + clicked.clear(); } } } |