Use proper check for distance

To avoid invalid results for r < 1.
dont-compose-content
elsid 4 years ago
parent a54c4bc2e9
commit 94e460ba1e
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -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);

Loading…
Cancel
Save