Explorar o código

Curve3.CatmullRom fix : amount reaches just 1.0 now

jbousquie %!s(int64=8) %!d(string=hai) anos
pai
achega
b08c8aadc4
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      src/Math/babylon.math.ts

+ 3 - 1
src/Math/babylon.math.ts

@@ -4824,11 +4824,13 @@
             var step = 1.0 / nbPoints;
             for (var i = 0; i < totalPoints.length - 3; i++) {
                 var amount = 0.0;
-                for (var c = 0; c <= nbPoints; c++) {
+                for (var c = 0; c < nbPoints; c++) {
                     catmullRom.push( Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount) );
                     amount += step
                 }
             }
+            i--;
+            catmullRom.push( Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount) );
             return new Curve3(catmullRom);
         }