Fix if condition to actually return the value...

This commit is contained in:
David Markowitz 2023-08-09 00:05:37 -07:00
parent 8da23df5d6
commit 7388d47b90

View File

@ -143,11 +143,13 @@ float dNavMesh::GetHeightAtPoint(const NiPoint3& location, const float halfExten
} }
#endif #endif
if (toReturn == 0.0f) { if (toReturn == 0.0f) {
toReturn = location.y;
// If we were unable to get the poly height, but the query returned a success, just use the height of the nearest point. // If we were unable to get the poly height, but the query returned a success, just use the height of the nearest point.
// This is what seems to happen anyways and it is better than returning zero. // This is what seems to happen anyways and it is better than returning zero.
} else if (hasPoly == DT_SUCCESS) { if (hasPoly == DT_SUCCESS) {
toReturn = nearestPoint[1]; toReturn = nearestPoint[1];
} else {
toReturn = location.y;
}
} }
// If we failed to even find a poly, do not change the height since we have no idea what it should be. // If we failed to even find a poly, do not change the height since we have no idea what it should be.