[libgdx] Fixed path constraint computations being invalid if a path's length is ever NaN.

This commit is contained in:
NathanSweet 2018-12-15 22:41:04 +01:00
parent 91a1dc4ece
commit e6acc6725b

View File

@ -208,7 +208,7 @@ public class PathConstraint implements Constraint {
float pathLength = lengths[curveCount];
if (percentPosition) position *= pathLength;
if (percentSpacing) {
for (int i = 0; i < spacesCount; i++)
for (int i = 1; i < spacesCount; i++)
spaces[i] *= pathLength;
}
world = this.world.setSize(8);
@ -319,7 +319,7 @@ public class PathConstraint implements Constraint {
else
position *= pathLength / path.getLengths()[curveCount - 1];
if (percentSpacing) {
for (int i = 0; i < spacesCount; i++)
for (int i = 1; i < spacesCount; i++)
spaces[i] *= pathLength;
}