mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
Use proper check for distance
To avoid invalid results for r < 1.
This commit is contained in:
parent
a54c4bc2e9
commit
94e460ba1e
@ -27,8 +27,7 @@ namespace DetourNavigator
|
|||||||
|
|
||||||
inline bool inRange(const osg::Vec3f& v1, const osg::Vec3f& v2, const float r)
|
inline bool inRange(const osg::Vec3f& v1, const osg::Vec3f& v2, const float r)
|
||||||
{
|
{
|
||||||
const auto d = v2 - v1;
|
return (osg::Vec2f(v1.x(), v1.z()) - osg::Vec2f(v2.x(), v2.z())).length() < r;
|
||||||
return (d.x() * d.x() + d.z() * d.z()) < r * r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<dtPolyRef> fixupCorridor(const std::vector<dtPolyRef>& path, const std::vector<dtPolyRef>& visited);
|
std::vector<dtPolyRef> fixupCorridor(const std::vector<dtPolyRef>& path, const std::vector<dtPolyRef>& visited);
|
||||||
|
Loading…
Reference in New Issue
Block a user