Browse Source

Curve3.CatmullRom fix : amount reaches just 1.0 now

jbousquie 8 năm trước cách đây
mục cha
commit
b08c8aadc4
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  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);
         }