[c][cpp] Fix path constraint for when path length is NaN.

This commit is contained in:
badlogic 2018-12-17 15:20:12 +01:00
parent 55f4a2968b
commit 503cdb81f4
2 changed files with 4 additions and 4 deletions

View File

@ -267,7 +267,7 @@ float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAtta
pathLength = lengths[curveCount]; pathLength = lengths[curveCount];
if (percentPosition) position *= pathLength; if (percentPosition) position *= pathLength;
if (percentSpacing) { if (percentSpacing) {
for (i = 0; i < spacesCount; i++) for (i = 1; i < spacesCount; i++)
spaces[i] *= pathLength; spaces[i] *= pathLength;
} }
if (self->worldCount != 8) { if (self->worldCount != 8) {
@ -397,7 +397,7 @@ float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAtta
else else
position *= pathLength / path->lengths[curveCount - 1]; position *= pathLength / path->lengths[curveCount - 1];
if (percentSpacing) { if (percentSpacing) {
for (i = 0; i < spacesCount; i++) for (i = 1; i < spacesCount; i++)
spaces[i] *= pathLength; spaces[i] *= pathLength;
} }

View File

@ -288,7 +288,7 @@ PathConstraint::computeWorldPositions(PathAttachment &path, int spacesCount, boo
} }
if (percentSpacing) { if (percentSpacing) {
for (int i = 0; i < spacesCount; ++i) { for (int i = 1; i < spacesCount; ++i) {
_spaces[i] *= pathLength; _spaces[i] *= pathLength;
} }
} }
@ -417,7 +417,7 @@ PathConstraint::computeWorldPositions(PathAttachment &path, int spacesCount, boo
} }
if (percentSpacing) { if (percentSpacing) {
for (int i = 0; i < spacesCount; ++i) { for (int i = 1; i < spacesCount; ++i) {
_spaces[i] *= pathLength; _spaces[i] *= pathLength;
} }
} }