mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 19:39:41 +00:00
Use z coordinate for path distance when diff by z is greater then actor height
This commit is contained in:
parent
81832f8e17
commit
e4d0af6a6d
1 changed files with 8 additions and 1 deletions
|
@ -81,13 +81,20 @@ namespace
|
|||
const auto realHalfExtents = world->getHalfExtents(actor);
|
||||
return 2 * std::max(realHalfExtents.x(), realHalfExtents.y());
|
||||
}
|
||||
|
||||
float getHeight(const MWWorld::ConstPtr& actor)
|
||||
{
|
||||
const auto world = MWBase::Environment::get().getWorld();
|
||||
const auto halfExtents = world->getHalfExtents(actor);
|
||||
return 2.0 * halfExtents.z();
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
float getPathDistance(const MWWorld::Ptr& actor, const osg::Vec3f& lhs, const osg::Vec3f& rhs)
|
||||
{
|
||||
if (canActorMoveByZAxis(actor))
|
||||
if (std::abs(lhs.z() - rhs.z()) > getHeight(actor) || canActorMoveByZAxis(actor))
|
||||
return distance(lhs, rhs);
|
||||
return distanceIgnoreZ(lhs, rhs);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue