Эх сурвалжийг харах

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

badlogic 6 жил өмнө
parent
commit
503cdb81f4

+ 2 - 2
spine-c/spine-c/src/spine/PathConstraint.c

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

+ 2 - 2
spine-cpp/spine-cpp/src/spine/PathConstraint.cpp

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