Bug in AstarMath.NearestPointStrict

Disclaimer: I’ve inherited a codebase with an old version (I believe from Sept 2014), however the newest changelog doesn’t report that this bug has been fixed in a more recent version.

When this method is called, and the parameters lineStart and lineEnd are the same point, there is a divide by zero operation that results in the returned point being (NaN, NaN, NaN).

This manifested when a seeker generated a path that had the same startNode and endNode, while using a StartEndModifier with exactStartPoint set to Interpolate. I’m sure there’s a bunch of other places it can pop up tho.

Hi

That definitely looks like a bug.
Fixed it in my dev version (along with a bunch of other similar methods).

Weird that I haven’t encountered it.

Thanks for reporting. : )