From ae0660db0aabab89cfa4f0ef259497d534308d81 Mon Sep 17 00:00:00 2001 From: Sam Hellawell Date: Wed, 31 Jul 2024 00:30:06 +0100 Subject: [PATCH] Use nodeMask... lets ignore the previous attempt --- apps/openmw/mwrender/renderingmanager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 07288c278b..7048f7c933 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -1051,6 +1051,7 @@ namespace MWRender RenderingManager::RayResult getIntersectionResult(osgUtil::LineSegmentIntersector* intersector, const osg::ref_ptr& visitor, std::span ignoreList = {}) { + constexpr auto nonObjectWorldMask = Mask_Terrain | Mask_Water; RenderingManager::RayResult result; result.mHit = false; result.mRatio = 0; @@ -1065,10 +1066,9 @@ namespace MWRender for (osg::NodePath::const_iterator it = intersection.nodePath.begin(); it != intersection.nodePath.end(); ++it) { - // Terrain doesnt contain any user data ptrs or flags, so we have to check the name - // TODO: better solution for this that could also be used for water and other world pieces with flags + const auto& nodeMask = (*it)->getNodeMask(); if (!hitNonObjectWorld) - hitNonObjectWorld = (*it)->getName() == std::string_view("Terrain Root"); + hitNonObjectWorld = nodeMask & nonObjectWorldMask; osg::UserDataContainer* userDataContainer = (*it)->getUserDataContainer(); if (!userDataContainer)