mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 12:23:53 +00:00
Find path for actors according to their abilities to swim and walk
This commit is contained in:
parent
dc09674362
commit
d02beae5a8
7 changed files with 92 additions and 25 deletions
|
@ -141,7 +141,7 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, const osg::Vec3f&
|
||||||
|| world->isFlying(actor);
|
|| world->isFlying(actor);
|
||||||
|
|
||||||
// Prohibit shortcuts for AiWander, if the actor can not move in 3 dimensions.
|
// Prohibit shortcuts for AiWander, if the actor can not move in 3 dimensions.
|
||||||
if (actorCanMoveByZ || getTypeId() != TypeIdWander)
|
if (actorCanMoveByZ)
|
||||||
mIsShortcutting = shortcutPath(start, dest, actor, &destInLOS, actorCanMoveByZ); // try to shortcut first
|
mIsShortcutting = shortcutPath(start, dest, actor, &destInLOS, actorCanMoveByZ); // try to shortcut first
|
||||||
|
|
||||||
if (!mIsShortcutting)
|
if (!mIsShortcutting)
|
||||||
|
@ -400,3 +400,17 @@ bool MWMechanics::AiPackage::isReachableRotatingOnTheRun(const MWWorld::Ptr& act
|
||||||
// no points of actor's circle should be farther from the center than destination point
|
// no points of actor's circle should be farther from the center than destination point
|
||||||
return (radius <= distToDest);
|
return (radius <= distToDest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DetourNavigator::Flags MWMechanics::AiPackage::getNavigatorFlags(const MWWorld::Ptr& actor) const
|
||||||
|
{
|
||||||
|
const auto& actorClass = actor.getClass();
|
||||||
|
DetourNavigator::Flags result = DetourNavigator::Flag_none;
|
||||||
|
|
||||||
|
if (actorClass.isPureWaterCreature(actor) || (getTypeId() != TypeIdWander && actorClass.canSwim(actor)))
|
||||||
|
result |= DetourNavigator::Flag_swim;
|
||||||
|
|
||||||
|
if (actorClass.canWalk(actor))
|
||||||
|
result |= DetourNavigator::Flag_walk;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
|
@ -132,6 +132,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
const PathgridGraph& getPathGridGraph(const MWWorld::CellStore* cell);
|
const PathgridGraph& getPathGridGraph(const MWWorld::CellStore* cell);
|
||||||
|
|
||||||
|
DetourNavigator::Flags getNavigatorFlags(const MWWorld::Ptr& actor) const;
|
||||||
|
|
||||||
// TODO: all this does not belong here, move into temporary storage
|
// TODO: all this does not belong here, move into temporary storage
|
||||||
PathFinder mPathFinder;
|
PathFinder mPathFinder;
|
||||||
ObstacleCheck mObstacleCheck;
|
ObstacleCheck mObstacleCheck;
|
||||||
|
|
|
@ -290,14 +290,14 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathFinder::buildPathByNavigator(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
|
void PathFinder::buildPathByNavigator(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
|
||||||
const osg::Vec3f& halfExtents)
|
const osg::Vec3f& halfExtents, const DetourNavigator::Flags flags)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mPath.clear();
|
mPath.clear();
|
||||||
|
|
||||||
const auto navigator = MWBase::Environment::get().getWorld()->getNavigator();
|
const auto navigator = MWBase::Environment::get().getWorld()->getNavigator();
|
||||||
navigator->findPath(halfExtents, startPoint, endPoint, std::back_inserter(mPath));
|
navigator->findPath(halfExtents, startPoint, endPoint, flags, std::back_inserter(mPath));
|
||||||
|
|
||||||
mConstructed = true;
|
mConstructed = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <components/detournavigator/flags.hpp>
|
||||||
#include <components/esm/defs.hpp>
|
#include <components/esm/defs.hpp>
|
||||||
#include <components/esm/loadpgrd.hpp>
|
#include <components/esm/loadpgrd.hpp>
|
||||||
|
|
||||||
|
@ -176,7 +177,7 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildPathByNavigator(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
|
void buildPathByNavigator(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
|
||||||
const osg::Vec3f& halfExtents);
|
const osg::Vec3f& halfExtents, const DetourNavigator::Flags flags);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mConstructed;
|
bool mConstructed;
|
||||||
|
|
|
@ -64,20 +64,20 @@ namespace
|
||||||
|
|
||||||
TEST_F(DetourNavigatorNavigatorTest, find_path_for_empty_should_throw_exception)
|
TEST_F(DetourNavigatorNavigatorTest, find_path_for_empty_should_throw_exception)
|
||||||
{
|
{
|
||||||
EXPECT_THROW(mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, mOut), InvalidArgument);
|
EXPECT_THROW(mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, mOut), InvalidArgument);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DetourNavigatorNavigatorTest, find_path_for_existing_agent_with_no_navmesh_should_throw_exception)
|
TEST_F(DetourNavigatorNavigatorTest, find_path_for_existing_agent_with_no_navmesh_should_throw_exception)
|
||||||
{
|
{
|
||||||
mNavigator->addAgent(mAgentHalfExtents);
|
mNavigator->addAgent(mAgentHalfExtents);
|
||||||
EXPECT_THROW(mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, mOut), NavigatorException);
|
EXPECT_THROW(mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, mOut), NavigatorException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DetourNavigatorNavigatorTest, find_path_for_removed_agent_should_throw_exception)
|
TEST_F(DetourNavigatorNavigatorTest, find_path_for_removed_agent_should_throw_exception)
|
||||||
{
|
{
|
||||||
mNavigator->addAgent(mAgentHalfExtents);
|
mNavigator->addAgent(mAgentHalfExtents);
|
||||||
mNavigator->removeAgent(mAgentHalfExtents);
|
mNavigator->removeAgent(mAgentHalfExtents);
|
||||||
EXPECT_THROW(mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, mOut), InvalidArgument);
|
EXPECT_THROW(mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, mOut), InvalidArgument);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DetourNavigatorNavigatorTest, add_agent_should_count_each_agent)
|
TEST_F(DetourNavigatorNavigatorTest, add_agent_should_count_each_agent)
|
||||||
|
@ -85,7 +85,7 @@ namespace
|
||||||
mNavigator->addAgent(mAgentHalfExtents);
|
mNavigator->addAgent(mAgentHalfExtents);
|
||||||
mNavigator->addAgent(mAgentHalfExtents);
|
mNavigator->addAgent(mAgentHalfExtents);
|
||||||
mNavigator->removeAgent(mAgentHalfExtents);
|
mNavigator->removeAgent(mAgentHalfExtents);
|
||||||
EXPECT_THROW(mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, mOut), NavigatorException);
|
EXPECT_THROW(mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, mOut), NavigatorException);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DetourNavigatorNavigatorTest, update_then_find_path_should_return_path)
|
TEST_F(DetourNavigatorNavigatorTest, update_then_find_path_should_return_path)
|
||||||
|
@ -105,7 +105,7 @@ namespace
|
||||||
mNavigator->update(mPlayerPosition);
|
mNavigator->update(mPlayerPosition);
|
||||||
mNavigator->wait();
|
mNavigator->wait();
|
||||||
|
|
||||||
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, mOut);
|
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, mOut);
|
||||||
|
|
||||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||||
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
||||||
|
@ -155,7 +155,7 @@ namespace
|
||||||
mNavigator->update(mPlayerPosition);
|
mNavigator->update(mPlayerPosition);
|
||||||
mNavigator->wait();
|
mNavigator->wait();
|
||||||
|
|
||||||
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, std::back_inserter(mPath));
|
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, std::back_inserter(mPath));
|
||||||
|
|
||||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||||
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
||||||
|
@ -188,7 +188,7 @@ namespace
|
||||||
mNavigator->wait();
|
mNavigator->wait();
|
||||||
|
|
||||||
mPath.clear();
|
mPath.clear();
|
||||||
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, std::back_inserter(mPath));
|
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, std::back_inserter(mPath));
|
||||||
|
|
||||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||||
osg::Vec3f(-215, 215, 1.87827122211456298828125),
|
osg::Vec3f(-215, 215, 1.87827122211456298828125),
|
||||||
|
@ -239,7 +239,7 @@ namespace
|
||||||
mNavigator->update(mPlayerPosition);
|
mNavigator->update(mPlayerPosition);
|
||||||
mNavigator->wait();
|
mNavigator->wait();
|
||||||
|
|
||||||
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, std::back_inserter(mPath));
|
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, std::back_inserter(mPath));
|
||||||
|
|
||||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||||
osg::Vec3f(-215, 215, 1.87827122211456298828125),
|
osg::Vec3f(-215, 215, 1.87827122211456298828125),
|
||||||
|
@ -274,7 +274,7 @@ namespace
|
||||||
mNavigator->wait();
|
mNavigator->wait();
|
||||||
|
|
||||||
mPath.clear();
|
mPath.clear();
|
||||||
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, mOut);
|
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, mOut);
|
||||||
|
|
||||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||||
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
||||||
|
@ -331,7 +331,7 @@ namespace
|
||||||
mNavigator->update(mPlayerPosition);
|
mNavigator->update(mPlayerPosition);
|
||||||
mNavigator->wait();
|
mNavigator->wait();
|
||||||
|
|
||||||
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, mOut);
|
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, mOut);
|
||||||
|
|
||||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||||
osg::Vec3f(-215, 215, 1.96328866481781005859375),
|
osg::Vec3f(-215, 215, 1.96328866481781005859375),
|
||||||
|
@ -387,7 +387,7 @@ namespace
|
||||||
mNavigator->update(mPlayerPosition);
|
mNavigator->update(mPlayerPosition);
|
||||||
mNavigator->wait();
|
mNavigator->wait();
|
||||||
|
|
||||||
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, mOut);
|
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, mOut);
|
||||||
|
|
||||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||||
osg::Vec3f(-215, 215, 1.9393787384033203125),
|
osg::Vec3f(-215, 215, 1.9393787384033203125),
|
||||||
|
@ -417,7 +417,7 @@ namespace
|
||||||
})) << mPath;
|
})) << mPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DetourNavigatorNavigatorTest, path_should_be_over_water_ground_lower_than_water)
|
TEST_F(DetourNavigatorNavigatorTest, path_should_be_over_water_ground_lower_than_water_with_only_swim_flag)
|
||||||
{
|
{
|
||||||
std::array<btScalar, 5 * 5> heightfieldData {{
|
std::array<btScalar, 5 * 5> heightfieldData {{
|
||||||
-50, -50, -50, -50, 0,
|
-50, -50, -50, -50, 0,
|
||||||
|
@ -440,7 +440,7 @@ namespace
|
||||||
mEnd.x() = 0;
|
mEnd.x() = 0;
|
||||||
mEnd.z() = 300;
|
mEnd.z() = 300;
|
||||||
|
|
||||||
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, mOut);
|
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_swim, mOut);
|
||||||
|
|
||||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||||
osg::Vec3f(0, 215, 185.33331298828125),
|
osg::Vec3f(0, 215, 185.33331298828125),
|
||||||
|
@ -463,7 +463,7 @@ namespace
|
||||||
})) << mPath;
|
})) << mPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DetourNavigatorNavigatorTest, path_should_be_over_water_when_ground_cross_water)
|
TEST_F(DetourNavigatorNavigatorTest, path_should_be_over_water_when_ground_cross_water_with_swim_and_walk_flags)
|
||||||
{
|
{
|
||||||
std::array<btScalar, 7 * 7> heightfieldData {{
|
std::array<btScalar, 7 * 7> heightfieldData {{
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
@ -486,7 +486,7 @@ namespace
|
||||||
mStart.x() = 0;
|
mStart.x() = 0;
|
||||||
mEnd.x() = 0;
|
mEnd.x() = 0;
|
||||||
|
|
||||||
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, mOut);
|
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_swim | Flag_walk, mOut);
|
||||||
|
|
||||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||||
osg::Vec3f(0, 215, -94.75363922119140625),
|
osg::Vec3f(0, 215, -94.75363922119140625),
|
||||||
|
@ -509,7 +509,7 @@ namespace
|
||||||
})) << mPath;
|
})) << mPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DetourNavigatorNavigatorTest, path_should_be_over_water_when_ground_cross_water_with_max_int_cells_size)
|
TEST_F(DetourNavigatorNavigatorTest, path_should_be_over_water_when_ground_cross_water_with_max_int_cells_size_and_swim_and_walk_flags)
|
||||||
{
|
{
|
||||||
std::array<btScalar, 7 * 7> heightfieldData {{
|
std::array<btScalar, 7 * 7> heightfieldData {{
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
@ -532,7 +532,7 @@ namespace
|
||||||
mStart.x() = 0;
|
mStart.x() = 0;
|
||||||
mEnd.x() = 0;
|
mEnd.x() = 0;
|
||||||
|
|
||||||
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, mOut);
|
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_swim | Flag_walk, mOut);
|
||||||
|
|
||||||
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||||
osg::Vec3f(0, 215, -94.75363922119140625),
|
osg::Vec3f(0, 215, -94.75363922119140625),
|
||||||
|
@ -554,4 +554,51 @@ namespace
|
||||||
osg::Vec3f(0, -215, -94.753631591796875),
|
osg::Vec3f(0, -215, -94.753631591796875),
|
||||||
})) << mPath;
|
})) << mPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DetourNavigatorNavigatorTest, path_should_be_over_ground_when_ground_cross_water_with_only_walk_flag)
|
||||||
|
{
|
||||||
|
std::array<btScalar, 7 * 7> heightfieldData {{
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, -100, -100, -100, -100, -100, 0,
|
||||||
|
0, -100, -150, -150, -150, -100, 0,
|
||||||
|
0, -100, -150, -200, -150, -100, 0,
|
||||||
|
0, -100, -150, -150, -150, -100, 0,
|
||||||
|
0, -100, -100, -100, -100, -100, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,
|
||||||
|
}};
|
||||||
|
btHeightfieldTerrainShape shape(7, 7, heightfieldData.data(), 1, 0, 0, 2, PHY_FLOAT, false);
|
||||||
|
shape.setLocalScaling(btVector3(128, 128, 1));
|
||||||
|
|
||||||
|
mNavigator->addAgent(mAgentHalfExtents);
|
||||||
|
mNavigator->addWater(osg::Vec2i(0, 0), 128 * 4, -25, btTransform::getIdentity());
|
||||||
|
mNavigator->addObject(1, shape, btTransform::getIdentity());
|
||||||
|
mNavigator->update(mPlayerPosition);
|
||||||
|
mNavigator->wait();
|
||||||
|
|
||||||
|
mStart.x() = 0;
|
||||||
|
mEnd.x() = 0;
|
||||||
|
|
||||||
|
mNavigator->findPath(mAgentHalfExtents, mStart, mEnd, Flag_walk, mOut);
|
||||||
|
|
||||||
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
||||||
|
osg::Vec3f(0, 215, -94.75363922119140625),
|
||||||
|
osg::Vec3f(9.8083515167236328125, 188.4185333251953125, -105.19994354248046875),
|
||||||
|
osg::Vec3f(19.6167049407958984375, 161.837066650390625, -114.25496673583984375),
|
||||||
|
osg::Vec3f(29.42505645751953125, 135.255615234375, -123.309967041015625),
|
||||||
|
osg::Vec3f(39.23340606689453125, 108.674163818359375, -132.3649749755859375),
|
||||||
|
osg::Vec3f(49.04175567626953125, 82.09270477294921875, -137.2874755859375),
|
||||||
|
osg::Vec3f(58.8501129150390625, 55.5112457275390625, -139.2451171875),
|
||||||
|
osg::Vec3f(68.6584625244140625, 28.9297885894775390625, -141.2027740478515625),
|
||||||
|
osg::Vec3f(78.4668121337890625, 2.3483295440673828125, -143.1604156494140625),
|
||||||
|
osg::Vec3f(88.27516937255859375, -24.233127593994140625, -141.3894805908203125),
|
||||||
|
osg::Vec3f(83.73651885986328125, -52.2005767822265625, -142.3761444091796875),
|
||||||
|
osg::Vec3f(79.19786834716796875, -80.16802978515625, -143.114837646484375),
|
||||||
|
osg::Vec3f(64.8477935791015625, -104.598602294921875, -137.840911865234375),
|
||||||
|
osg::Vec3f(50.497714996337890625, -129.0291748046875, -131.45831298828125),
|
||||||
|
osg::Vec3f(36.147632598876953125, -153.459747314453125, -121.42321014404296875),
|
||||||
|
osg::Vec3f(21.7975559234619140625, -177.8903350830078125, -111.38809967041015625),
|
||||||
|
osg::Vec3f(7.44747829437255859375, -202.3209075927734375, -101.1938323974609375),
|
||||||
|
osg::Vec3f(0, -215, -94.753631591796875),
|
||||||
|
})) << mPath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,13 +219,14 @@ namespace DetourNavigator
|
||||||
|
|
||||||
template <class OutputIterator>
|
template <class OutputIterator>
|
||||||
OutputIterator findSmoothPath(const dtNavMesh& navMesh, const osg::Vec3f& halfExtents,
|
OutputIterator findSmoothPath(const dtNavMesh& navMesh, const osg::Vec3f& halfExtents,
|
||||||
const osg::Vec3f& start, const osg::Vec3f& end, const Settings& settings, OutputIterator out)
|
const osg::Vec3f& start, const osg::Vec3f& end, const Flags includeFlags,
|
||||||
|
const Settings& settings, OutputIterator out)
|
||||||
{
|
{
|
||||||
dtNavMeshQuery navMeshQuery;
|
dtNavMeshQuery navMeshQuery;
|
||||||
OPENMW_CHECK_DT_STATUS(navMeshQuery.init(&navMesh, settings.mMaxNavMeshQueryNodes));
|
OPENMW_CHECK_DT_STATUS(navMeshQuery.init(&navMesh, settings.mMaxNavMeshQueryNodes));
|
||||||
|
|
||||||
dtQueryFilter queryFilter;
|
dtQueryFilter queryFilter;
|
||||||
queryFilter.setIncludeFlags(Flag_swim | Flag_walk);
|
queryFilter.setIncludeFlags(includeFlags);
|
||||||
|
|
||||||
dtPolyRef startRef = 0;
|
dtPolyRef startRef = 0;
|
||||||
osg::Vec3f startPolygonPosition;
|
osg::Vec3f startPolygonPosition;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVIGATOR_H
|
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVIGATOR_H
|
||||||
|
|
||||||
#include "findsmoothpath.hpp"
|
#include "findsmoothpath.hpp"
|
||||||
|
#include "flags.hpp"
|
||||||
#include "navmeshmanager.hpp"
|
#include "navmeshmanager.hpp"
|
||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
#include "settingsutils.hpp"
|
#include "settingsutils.hpp"
|
||||||
|
@ -48,11 +49,12 @@ namespace DetourNavigator
|
||||||
|
|
||||||
template <class OutputIterator>
|
template <class OutputIterator>
|
||||||
OutputIterator findPath(const osg::Vec3f& agentHalfExtents, const osg::Vec3f& start,
|
OutputIterator findPath(const osg::Vec3f& agentHalfExtents, const osg::Vec3f& start,
|
||||||
const osg::Vec3f& end, OutputIterator out) const
|
const osg::Vec3f& end, const Flags includeFlags, OutputIterator out) const
|
||||||
{
|
{
|
||||||
const auto navMesh = mNavMeshManager.getNavMesh(agentHalfExtents);
|
const auto navMesh = mNavMeshManager.getNavMesh(agentHalfExtents);
|
||||||
return findSmoothPath(*navMesh.lock(), toNavMeshCoordinates(mSettings, agentHalfExtents),
|
return findSmoothPath(*navMesh.lock(), toNavMeshCoordinates(mSettings, agentHalfExtents),
|
||||||
toNavMeshCoordinates(mSettings, start), toNavMeshCoordinates(mSettings, end), mSettings, out);
|
toNavMeshCoordinates(mSettings, start), toNavMeshCoordinates(mSettings, end), includeFlags,
|
||||||
|
mSettings, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<osg::Vec3f, std::shared_ptr<NavMeshCacheItem>> getNavMeshes() const;
|
std::map<osg::Vec3f, std::shared_ptr<NavMeshCacheItem>> getNavMeshes() const;
|
||||||
|
|
Loading…
Reference in a new issue