Build straight path for wandering flying and water creatures

pull/541/head
elsid 6 years ago
parent ebdff5d96e
commit ff67a9e233
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -318,10 +318,17 @@ namespace MWMechanics
if ((isWaterCreature || isFlyingCreature) && destinationThroughGround(currentPosition, mDestination))
continue;
const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor);
mPathFinder.buildPath(actor, currentPosition, mDestination, actor.getCell(),
getPathGridGraph(actor.getCell()), halfExtents, getNavigatorFlags(actor));
mPathFinder.addPointToPath(mDestination);
if (isWaterCreature || isFlyingCreature)
{
mPathFinder.buildStraightPath(mDestination);
}
else
{
const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor);
mPathFinder.buildPath(actor, currentPosition, mDestination, actor.getCell(),
getPathGridGraph(actor.getCell()), halfExtents, getNavigatorFlags(actor));
mPathFinder.addPointToPath(mDestination);
}
if (mPathFinder.isPathConstructed())
{

@ -269,6 +269,13 @@ namespace MWMechanics
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,
const MWWorld::CellStore* cell, const PathgridGraph& pathgridGraph)
{

@ -72,6 +72,8 @@ namespace MWMechanics
mCell = nullptr;
}
void buildStraightPath(const osg::Vec3f& endPoint);
void buildPathByPathgrid(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
const MWWorld::CellStore* cell, const PathgridGraph& pathgridGraph);

Loading…
Cancel
Save