1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 03:35:27 +00:00

Drop path points while tolerance allows

This commit is contained in:
elsid 2019-03-08 19:58:42 +03:00
parent b9f21ec81a
commit ea80a81538
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

View File

@ -262,9 +262,10 @@ namespace MWMechanics
if (mPath.empty())
return;
const auto tolerance = mPath.size() > 1 ? pointTolerance : destinationTolerance;
while (mPath.size() > 1 && sqrDistanceIgnoreZ(mPath.front(), position) < pointTolerance * pointTolerance)
mPath.pop_front();
if (sqrDistanceIgnoreZ(mPath.front(), position) < tolerance * tolerance)
if (mPath.size() == 1 && sqrDistanceIgnoreZ(mPath.front(), position) < destinationTolerance * destinationTolerance)
mPath.pop_front();
}