SebLague / Path-Creator

Path creation asset for Unity game development
https://assetstore.unity.com/packages/tools/utilities/b-zier-path-creator-136082
MIT License
1.83k stars 319 forks source link

CalculateClosestPointOnPathData returns NaN #138

Open Agenicy opened 1 year ago

Agenicy commented 1 year ago

In VertexPath.cs, line 325: float t = (closestPoint - GetPoint(closestSegmentIndexA)).magnitude / closestSegmentLength; will cause NaN while closestSegmentLength is zero at some time. It should be like: float t = (closestPoint - GetPoint(closestSegmentIndexA)).magnitude / (closestSegmentLength + 1e-4f); or something else?