From 1d46ac19ff0e488c03be0a3cbd68e9d19c94a736 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 24 Jun 2014 02:24:32 +0200 Subject: [PATCH] Fix being able to activate through terrain --- apps/openmw/mwworld/worldimp.cpp | 12 +++++++++--- libs/openengine/bullet/physic.cpp | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index b4957abfd..c4e4e3d3a 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1471,8 +1471,13 @@ namespace MWWorld std::vector < std::pair < float, std::string > >::iterator it = results.begin(); while (it != results.end()) { - if ( (*it).second.find("HeightField") != std::string::npos // not interested in terrain - || getPtrViaHandle((*it).second) == mPlayer->getPlayer() ) // not interested in player (unless you want to talk to yourself) + if ((*it).second.find("HeightField") != std::string::npos) // Don't attempt to getPtrViaHandle on terrain + { + ++it; + continue; + } + + if (getPtrViaHandle((*it).second) == mPlayer->getPlayer() ) // not interested in player (unless you want to talk to yourself) { it = results.erase(it); } @@ -1480,7 +1485,8 @@ namespace MWWorld ++it; } - if (results.empty()) + if (results.empty() + || results.front().second.find("HeightField") != std::string::npos) // Blocked by terrain { mFacedHandle = ""; mFacedDistance = FLT_MAX; diff --git a/libs/openengine/bullet/physic.cpp b/libs/openengine/bullet/physic.cpp index 469e33f25..d00441fdf 100644 --- a/libs/openengine/bullet/physic.cpp +++ b/libs/openengine/bullet/physic.cpp @@ -805,7 +805,7 @@ namespace Physic { MyRayResultCallback resultCallback1; resultCallback1.m_collisionFilterGroup = 0xff; - resultCallback1.m_collisionFilterMask = CollisionType_Raycasting|CollisionType_Actor; + resultCallback1.m_collisionFilterMask = CollisionType_Raycasting|CollisionType_Actor|CollisionType_HeightMap; mDynamicsWorld->rayTest(from, to, resultCallback1); std::vector< std::pair > results = resultCallback1.results;