Kaynağa Gözat

Curve3.CatmullRom fix : amount reaches just 1.0 now

jbousquie 8 yıl önce
ebeveyn
işleme
b08c8aadc4
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  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);
         }