mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 20:15:34 +00:00
Build straight path for wandering flying and water creatures
This commit is contained in:
parent
ebdff5d96e
commit
ff67a9e233
3 changed files with 20 additions and 4 deletions
|
@ -318,10 +318,17 @@ namespace MWMechanics
|
||||||
if ((isWaterCreature || isFlyingCreature) && destinationThroughGround(currentPosition, mDestination))
|
if ((isWaterCreature || isFlyingCreature) && destinationThroughGround(currentPosition, mDestination))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (isWaterCreature || isFlyingCreature)
|
||||||
|
{
|
||||||
|
mPathFinder.buildStraightPath(mDestination);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor);
|
const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor);
|
||||||
mPathFinder.buildPath(actor, currentPosition, mDestination, actor.getCell(),
|
mPathFinder.buildPath(actor, currentPosition, mDestination, actor.getCell(),
|
||||||
getPathGridGraph(actor.getCell()), halfExtents, getNavigatorFlags(actor));
|
getPathGridGraph(actor.getCell()), halfExtents, getNavigatorFlags(actor));
|
||||||
mPathFinder.addPointToPath(mDestination);
|
mPathFinder.addPointToPath(mDestination);
|
||||||
|
}
|
||||||
|
|
||||||
if (mPathFinder.isPathConstructed())
|
if (mPathFinder.isPathConstructed())
|
||||||
{
|
{
|
||||||
|
|
|
@ -269,6 +269,13 @@ namespace MWMechanics
|
||||||
mPath.pop_front();
|
mPath.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathFinder::buildStraightPath(const osg::Vec3f& endPoint)
|
||||||
|
{
|
||||||
|
mPath.clear();
|
||||||
|
mPath.push_back(endPoint);
|
||||||
|
mConstructed = true;
|
||||||
|
}
|
||||||
|
|
||||||
void PathFinder::buildPathByPathgrid(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
|
void PathFinder::buildPathByPathgrid(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
|
||||||
const MWWorld::CellStore* cell, const PathgridGraph& pathgridGraph)
|
const MWWorld::CellStore* cell, const PathgridGraph& pathgridGraph)
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,6 +72,8 @@ namespace MWMechanics
|
||||||
mCell = nullptr;
|
mCell = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void buildStraightPath(const osg::Vec3f& endPoint);
|
||||||
|
|
||||||
void buildPathByPathgrid(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
|
void buildPathByPathgrid(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
|
||||||
const MWWorld::CellStore* cell, const PathgridGraph& pathgridGraph);
|
const MWWorld::CellStore* cell, const PathgridGraph& pathgridGraph);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue