1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-29 12:20:41 +00:00

Use proper check for distance

To avoid invalid results for r < 1.
This commit is contained in:
elsid 2021-06-30 20:11:38 +02:00
parent a54c4bc2e9
commit 94e460ba1e
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

View File

@ -27,8 +27,7 @@ namespace DetourNavigator
inline bool inRange(const osg::Vec3f& v1, const osg::Vec3f& v2, const float r)
{
const auto d = v2 - v1;
return (d.x() * d.x() + d.z() * d.z()) < r * r;
return (osg::Vec2f(v1.x(), v1.z()) - osg::Vec2f(v2.x(), v2.z())).length() < r;
}
std::vector<dtPolyRef> fixupCorridor(const std::vector<dtPolyRef>& path, const std::vector<dtPolyRef>& visited);