瀏覽代碼

Curve3.CatmullRom fix : amount reaches just 1.0 now

jbousquie 8 年之前
父節點
當前提交
b08c8aadc4
共有 1 個文件被更改,包括 3 次插入1 次删除
  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);
         }