Browse Source

Adding some autoanimate lines

David Catuhe 10 năm trước cách đây
mục cha
commit
6dfb6036b7
38 tập tin đã thay đổi với 3091 bổ sung3176 xóa
  1. 20 20
      dist/preview release/babylon.core.js
  2. 2567 2555
      dist/preview release/babylon.d.ts
  3. 25 25
      dist/preview release/babylon.js
  4. 304 268
      dist/preview release/babylon.max.js
  5. 21 21
      dist/preview release/babylon.noworker.js
  6. 57 0
      src/Animations/babylon.animation.js
  7. 1 2
      src/Animations/babylon.animation.ts
  8. 5 5
      src/Cameras/babylon.arcRotateCamera.js
  9. 0 1
      src/Cameras/babylon.arcRotateCamera.ts
  10. 1 1
      src/Cameras/babylon.camera.js
  11. 1 1
      src/Cameras/babylon.camera.ts
  12. 5 5
      src/Cameras/babylon.targetCamera.js
  13. 2 2
      src/Cameras/babylon.targetCamera.ts
  14. 1 1
      src/Culling/babylon.boundingBox.js
  15. 1 1
      src/Culling/babylon.boundingSphere.js
  16. 1 1
      src/Culling/babylon.ray.js
  17. 1 1
      src/Culling/babylon.ray.ts
  18. 1 1
      src/Lights/babylon.light.js
  19. 1 1
      src/Lights/babylon.light.ts
  20. 3 0
      src/Loading/Plugins/babylon.babylonFileLoader.js
  21. 4 0
      src/Loading/Plugins/babylon.babylonFileLoader.ts
  22. 29 242
      src/Math/babylon.math.js
  23. 1 3
      src/Math/babylon.math.ts
  24. 3 3
      src/Mesh/babylon.abstractMesh.js
  25. 1 1
      src/Mesh/babylon.mesh.js
  26. 1 1
      src/Mesh/babylon.mesh.ts
  27. 1 1
      src/Mesh/babylon.meshSimplification.js
  28. 3 0
      src/Particles/babylon.particleSystem.js
  29. 4 0
      src/Particles/babylon.particleSystem.ts
  30. 4 0
      src/Physics/Plugins/babylon.cannonJSPlugin.js
  31. 1 2
      src/Physics/Plugins/babylon.cannonJSPlugin.ts
  32. 7 0
      src/Physics/Plugins/babylon.oimoJSPlugin.js
  33. 3 3
      src/Physics/Plugins/babylon.oimoJSPlugin.ts
  34. 9 0
      src/Physics/babylon.physicsImpostor.js
  35. 1 1
      src/Physics/babylon.physicsImpostor.ts
  36. 0 5
      src/Tools/babylon.tools.js
  37. 1 1
      src/Tools/babylon.tools.ts
  38. 0 1
      src/babylon.engine.js

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 20 - 20
dist/preview release/babylon.core.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2567 - 2555
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 25 - 25
dist/preview release/babylon.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 304 - 268
dist/preview release/babylon.max.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 21 - 21
dist/preview release/babylon.noworker.js


+ 57 - 0
src/Animations/babylon.animation.js

@@ -22,6 +22,63 @@ var BABYLON;
         return AnimationEvent;
     })();
     BABYLON.AnimationEvent = AnimationEvent;
+    var PathCursor = (function () {
+        function PathCursor(path) {
+            this.path = path;
+            this._onchange = new Array();
+            this.value = 0;
+            this.animations = new Array();
+        }
+        PathCursor.prototype.getPoint = function () {
+            var point = this.path.getPointAtLengthPosition(this.value);
+            return new BABYLON.Vector3(point.x, 0, point.y);
+        };
+        PathCursor.prototype.moveAhead = function (step) {
+            if (step === void 0) { step = 0.002; }
+            this.move(step);
+            return this;
+        };
+        PathCursor.prototype.moveBack = function (step) {
+            if (step === void 0) { step = 0.002; }
+            this.move(-step);
+            return this;
+        };
+        PathCursor.prototype.move = function (step) {
+            if (Math.abs(step) > 1) {
+                throw "step size should be less than 1.";
+            }
+            this.value += step;
+            this.ensureLimits();
+            this.raiseOnChange();
+            return this;
+        };
+        PathCursor.prototype.ensureLimits = function () {
+            while (this.value > 1) {
+                this.value -= 1;
+            }
+            while (this.value < 0) {
+                this.value += 1;
+            }
+            return this;
+        };
+        // used by animation engine
+        PathCursor.prototype.markAsDirty = function (propertyName) {
+            this.ensureLimits();
+            this.raiseOnChange();
+            return this;
+        };
+        PathCursor.prototype.raiseOnChange = function () {
+            var _this = this;
+            this._onchange.forEach(function (f) { return f(_this); });
+            return this;
+        };
+        PathCursor.prototype.onchange = function (f) {
+            this._onchange.push(f);
+            return this;
+        };
+        return PathCursor;
+    })();
+    BABYLON.PathCursor = PathCursor;
     var Animation = (function () {
         function Animation(name, targetProperty, framePerSecond, dataType, loopMode, enableBlending) {
             this.name = name;

+ 1 - 2
src/Animations/babylon.animation.ts

@@ -12,7 +12,7 @@
         constructor(public frame: number, public action: () => void, public onlyOnce?: boolean) {
         }
     }
-    
+
     export class PathCursor {
         private _onchange = new Array<(cursor: PathCursor) => void>();
 
@@ -737,4 +737,3 @@
 } 
 
 
-

+ 5 - 5
src/Cameras/babylon.arcRotateCamera.js

@@ -399,11 +399,11 @@ var BABYLON;
                 this.inertialAlphaOffset *= this.inertia;
                 this.inertialBetaOffset *= this.inertia;
                 this.inertialRadiusOffset *= this.inertia;
-                if (Math.abs(this.inertialAlphaOffset) < BABYLON.Engine.Epsilon)
+                if (Math.abs(this.inertialAlphaOffset) < BABYLON.Epsilon)
                     this.inertialAlphaOffset = 0;
-                if (Math.abs(this.inertialBetaOffset) < BABYLON.Engine.Epsilon)
+                if (Math.abs(this.inertialBetaOffset) < BABYLON.Epsilon)
                     this.inertialBetaOffset = 0;
-                if (Math.abs(this.inertialRadiusOffset) < BABYLON.Engine.Epsilon)
+                if (Math.abs(this.inertialRadiusOffset) < BABYLON.Epsilon)
                     this.inertialRadiusOffset = 0;
             }
             // Panning inertia
@@ -414,9 +414,9 @@ var BABYLON;
                 }
                 this.inertialPanningX *= this.inertia;
                 this.inertialPanningY *= this.inertia;
-                if (Math.abs(this.inertialPanningX) < BABYLON.Engine.Epsilon)
+                if (Math.abs(this.inertialPanningX) < BABYLON.Epsilon)
                     this.inertialPanningX = 0;
-                if (Math.abs(this.inertialPanningY) < BABYLON.Engine.Epsilon)
+                if (Math.abs(this.inertialPanningY) < BABYLON.Epsilon)
                     this.inertialPanningY = 0;
                 this._localDirection.copyFromFloats(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY);
                 this._localDirection.multiplyInPlace(this.panningAxis);

+ 0 - 1
src/Cameras/babylon.arcRotateCamera.ts

@@ -745,4 +745,3 @@
         }
     }
 } 
-

+ 1 - 1
src/Cameras/babylon.camera.js

@@ -543,7 +543,7 @@ var BABYLON;
                 BABYLON.Node.ParseAnimationRanges(camera, parsedCamera, scene);
             }
             if (parsedCamera.autoAnimate) {
-                scene.beginAnimation(camera, parsedCamera.autoAnimateFrom, parsedCamera.autoAnimateTo, parsedCamera.autoAnimateLoop, 1.0);
+                scene.beginAnimation(camera, parsedCamera.autoAnimateFrom, parsedCamera.autoAnimateTo, parsedCamera.autoAnimateLoop, parsedCamera.autoAnimateSpeed || 1.0);
             }
             return camera;
         };

+ 1 - 1
src/Cameras/babylon.camera.ts

@@ -660,7 +660,7 @@
             }
 
             if (parsedCamera.autoAnimate) {
-                scene.beginAnimation(camera, parsedCamera.autoAnimateFrom, parsedCamera.autoAnimateTo, parsedCamera.autoAnimateLoop, 1.0);
+                scene.beginAnimation(camera, parsedCamera.autoAnimateFrom, parsedCamera.autoAnimateTo, parsedCamera.autoAnimateLoop, parsedCamera.autoAnimateSpeed || 1.0);
             }
 
             return camera;

+ 5 - 5
src/Cameras/babylon.targetCamera.js

@@ -135,22 +135,22 @@ var BABYLON;
             }
             // Inertia
             if (needToMove) {
-                if (Math.abs(this.cameraDirection.x) < BABYLON.Engine.Epsilon) {
+                if (Math.abs(this.cameraDirection.x) < BABYLON.Epsilon) {
                     this.cameraDirection.x = 0;
                 }
-                if (Math.abs(this.cameraDirection.y) < BABYLON.Engine.Epsilon) {
+                if (Math.abs(this.cameraDirection.y) < BABYLON.Epsilon) {
                     this.cameraDirection.y = 0;
                 }
-                if (Math.abs(this.cameraDirection.z) < BABYLON.Engine.Epsilon) {
+                if (Math.abs(this.cameraDirection.z) < BABYLON.Epsilon) {
                     this.cameraDirection.z = 0;
                 }
                 this.cameraDirection.scaleInPlace(this.inertia);
             }
             if (needToRotate) {
-                if (Math.abs(this.cameraRotation.x) < BABYLON.Engine.Epsilon) {
+                if (Math.abs(this.cameraRotation.x) < BABYLON.Epsilon) {
                     this.cameraRotation.x = 0;
                 }
-                if (Math.abs(this.cameraRotation.y) < BABYLON.Engine.Epsilon) {
+                if (Math.abs(this.cameraRotation.y) < BABYLON.Epsilon) {
                     this.cameraRotation.y = 0;
                 }
                 this.cameraRotation.scaleInPlace(this.inertia);

+ 2 - 2
src/Cameras/babylon.targetCamera.ts

@@ -265,8 +265,8 @@
                 case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
                 case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:
                 case Camera.RIG_MODE_VR:
-                    var camLeft = <TargetCamera> this._rigCameras[0];
-                    var camRight = <TargetCamera> this._rigCameras[1];
+                    var camLeft = <TargetCamera>this._rigCameras[0];
+                    var camRight = <TargetCamera>this._rigCameras[1];
 
                     if (this.cameraRigMode === Camera.RIG_MODE_VR) {
                         camLeft.rotation.x = camRight.rotation.x = this.rotation.x;

+ 1 - 1
src/Culling/babylon.boundingBox.js

@@ -75,7 +75,7 @@ var BABYLON;
             return BoundingBox.IsCompletelyInFrustum(this.vectorsWorld, frustumPlanes);
         };
         BoundingBox.prototype.intersectsPoint = function (point) {
-            var delta = -BABYLON.Engine.Epsilon;
+            var delta = -BABYLON.Epsilon;
             if (this.maximumWorld.x - point.x < delta || delta > point.x - this.minimumWorld.x)
                 return false;
             if (this.maximumWorld.y - point.y < delta || delta > point.y - this.minimumWorld.y)

+ 1 - 1
src/Culling/babylon.boundingSphere.js

@@ -29,7 +29,7 @@ var BABYLON;
             var y = this.centerWorld.y - point.y;
             var z = this.centerWorld.z - point.z;
             var distance = Math.sqrt((x * x) + (y * y) + (z * z));
-            if (Math.abs(this.radiusWorld - distance) < BABYLON.Engine.Epsilon)
+            if (Math.abs(this.radiusWorld - distance) < BABYLON.Epsilon)
                 return false;
             return true;
         };

+ 1 - 1
src/Culling/babylon.ray.js

@@ -166,6 +166,6 @@ var BABYLON;
             return new Ray(newOrigin, newDirection, ray.length);
         };
         return Ray;
-    }());
+    })();
     BABYLON.Ray = Ray;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Culling/babylon.ray.ts

@@ -1,4 +1,4 @@
-module BABYLON {
+module BABYLON {
     export class Ray {
         private _edge1: Vector3;
         private _edge2: Vector3;

+ 1 - 1
src/Lights/babylon.light.js

@@ -134,7 +134,7 @@ var BABYLON;
                 BABYLON.Node.ParseAnimationRanges(light, parsedLight, scene);
             }
             if (parsedLight.autoAnimate) {
-                scene.beginAnimation(light, parsedLight.autoAnimateFrom, parsedLight.autoAnimateTo, parsedLight.autoAnimateLoop, 1.0);
+                scene.beginAnimation(light, parsedLight.autoAnimateFrom, parsedLight.autoAnimateTo, parsedLight.autoAnimateLoop, parsedLight.autoAnimateSpeed || 1.0);
             }
             return light;
         };

+ 1 - 1
src/Lights/babylon.light.ts

@@ -194,7 +194,7 @@
             }
 
             if (parsedLight.autoAnimate) {
-                scene.beginAnimation(light, parsedLight.autoAnimateFrom, parsedLight.autoAnimateTo, parsedLight.autoAnimateLoop, 1.0);
+                scene.beginAnimation(light, parsedLight.autoAnimateFrom, parsedLight.autoAnimateTo, parsedLight.autoAnimateLoop, parsedLight.autoAnimateSpeed || 1.0);
             }
 
             return light;

+ 3 - 0
src/Loading/Plugins/babylon.babylonFileLoader.js

@@ -214,6 +214,9 @@ var BABYLON;
                         scene.animations.push(BABYLON.Animation.Parse(parsedAnimation));
                     }
                 }
+                if (parsedData.autoAnimate) {
+                    scene.beginAnimation(scene, parsedData.autoAnimateFrom, parsedData.autoAnimateTo, parsedData.autoAnimateLoop, parsedData.autoAnimateSpeed || 1.0);
+                }
                 // Materials
                 if (parsedData.materials) {
                     for (index = 0, cache = parsedData.materials.length; index < cache; index++) {

+ 4 - 0
src/Loading/Plugins/babylon.babylonFileLoader.ts

@@ -230,6 +230,10 @@
                 }
             }
 
+            if (parsedData.autoAnimate) {
+                scene.beginAnimation(scene, parsedData.autoAnimateFrom, parsedData.autoAnimateTo, parsedData.autoAnimateLoop, parsedData.autoAnimateSpeed || 1.0);
+            }
+
             // Materials
             if (parsedData.materials) {
                 for (index = 0, cache = parsedData.materials.length; index < cache; index++) {

+ 29 - 242
src/Math/babylon.math.js

@@ -2,6 +2,18 @@ var BABYLON;
 (function (BABYLON) {
     BABYLON.ToGammaSpace = 1 / 2.2;
     BABYLON.ToLinearSpace = 2.2;
+    BABYLON.Epsilon = 0.001;
+    var MathTools = (function () {
+        function MathTools() {
+        }
+        MathTools.WithinEpsilon = function (a, b, epsilon) {
+            if (epsilon === void 0) { epsilon = 1.401298E-45; }
+            var num = a - b;
+            return -epsilon <= num && num <= epsilon;
+        };
+        return MathTools;
+    })();
+    BABYLON.MathTools = MathTools;
     var Color3 = (function () {
         function Color3(r, g, b) {
             if (r === void 0) { r = 0; }
@@ -361,8 +373,8 @@ var BABYLON;
             return otherVector && this.x === otherVector.x && this.y === otherVector.y;
         };
         Vector2.prototype.equalsWithEpsilon = function (otherVector, epsilon) {
-            if (epsilon === void 0) { epsilon = BABYLON.Engine.Epsilon; }
-            return otherVector && BABYLON.Tools.WithinEpsilon(this.x, otherVector.x, epsilon) && BABYLON.Tools.WithinEpsilon(this.y, otherVector.y, epsilon);
+            if (epsilon === void 0) { epsilon = BABYLON.Epsilon; }
+            return otherVector && MathTools.WithinEpsilon(this.x, otherVector.x, epsilon) && MathTools.WithinEpsilon(this.y, otherVector.y, epsilon);
         };
         // Properties
         Vector2.prototype.length = function () {
@@ -562,8 +574,8 @@ var BABYLON;
             return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z;
         };
         Vector3.prototype.equalsWithEpsilon = function (otherVector, epsilon) {
-            if (epsilon === void 0) { epsilon = BABYLON.Engine.Epsilon; }
-            return otherVector && BABYLON.Tools.WithinEpsilon(this.x, otherVector.x, epsilon) && BABYLON.Tools.WithinEpsilon(this.y, otherVector.y, epsilon) && BABYLON.Tools.WithinEpsilon(this.z, otherVector.z, epsilon);
+            if (epsilon === void 0) { epsilon = BABYLON.Epsilon; }
+            return otherVector && MathTools.WithinEpsilon(this.x, otherVector.x, epsilon) && MathTools.WithinEpsilon(this.y, otherVector.y, epsilon) && MathTools.WithinEpsilon(this.z, otherVector.z, epsilon);
         };
         Vector3.prototype.equalsToFloats = function (x, y, z) {
             return this.x === x && this.y === y && this.z === z;
@@ -806,7 +818,7 @@ var BABYLON;
             source.y = -(source.y / viewportHeight * 2 - 1);
             var vector = Vector3.TransformCoordinates(source, matrix);
             var num = source.x * matrix.m[3] + source.y * matrix.m[7] + source.z * matrix.m[11] + matrix.m[15];
-            if (BABYLON.Tools.WithinEpsilon(num, 1.0)) {
+            if (MathTools.WithinEpsilon(num, 1.0)) {
                 vector = vector.scale(1.0 / num);
             }
             return vector;
@@ -817,7 +829,7 @@ var BABYLON;
             var screenSource = new Vector3(source.x / viewportWidth * 2 - 1, -(source.y / viewportHeight * 2 - 1), source.z);
             var vector = Vector3.TransformCoordinates(screenSource, matrix);
             var num = screenSource.x * matrix.m[3] + screenSource.y * matrix.m[7] + screenSource.z * matrix.m[11] + matrix.m[15];
-            if (BABYLON.Tools.WithinEpsilon(num, 1.0)) {
+            if (MathTools.WithinEpsilon(num, 1.0)) {
                 vector = vector.scale(1.0 / num);
             }
             return vector;
@@ -881,10 +893,10 @@ var BABYLON;
             // Rv3(u) = u1, and u1 belongs to plane xOz
             // Rv3(w) = w1 = w invariant
             var u1 = Tmp.Vector3[1];
-            if (BABYLON.Tools.WithinEpsilon(w.z, 0, BABYLON.Engine.Epsilon)) {
+            if (MathTools.WithinEpsilon(w.z, 0, BABYLON.Epsilon)) {
                 z = 1.0;
             }
-            else if (BABYLON.Tools.WithinEpsilon(w.x, 0, BABYLON.Engine.Epsilon)) {
+            else if (MathTools.WithinEpsilon(w.x, 0, BABYLON.Epsilon)) {
                 x = 1.0;
             }
             else {
@@ -918,7 +930,7 @@ var BABYLON;
             y = 0.0;
             z = 0.0;
             sign = -1.0;
-            if (BABYLON.Tools.WithinEpsilon(w.z, 0, BABYLON.Engine.Epsilon)) {
+            if (MathTools.WithinEpsilon(w.z, 0, BABYLON.Epsilon)) {
                 x = 1.0;
             }
             else {
@@ -1059,12 +1071,12 @@ var BABYLON;
             return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z && this.w === otherVector.w;
         };
         Vector4.prototype.equalsWithEpsilon = function (otherVector, epsilon) {
-            if (epsilon === void 0) { epsilon = BABYLON.Engine.Epsilon; }
+            if (epsilon === void 0) { epsilon = BABYLON.Epsilon; }
             return otherVector
-                && BABYLON.Tools.WithinEpsilon(this.x, otherVector.x, epsilon)
-                && BABYLON.Tools.WithinEpsilon(this.y, otherVector.y, epsilon)
-                && BABYLON.Tools.WithinEpsilon(this.z, otherVector.z, epsilon)
-                && BABYLON.Tools.WithinEpsilon(this.w, otherVector.w, epsilon);
+                && MathTools.WithinEpsilon(this.x, otherVector.x, epsilon)
+                && MathTools.WithinEpsilon(this.y, otherVector.y, epsilon)
+                && MathTools.WithinEpsilon(this.z, otherVector.z, epsilon)
+                && MathTools.WithinEpsilon(this.w, otherVector.w, epsilon);
         };
         Vector4.prototype.equalsToFloats = function (x, y, z, w) {
             return this.x === x && this.y === y && this.z === z && this.w === w;
@@ -2308,174 +2320,6 @@ var BABYLON;
         return Frustum;
     })();
     BABYLON.Frustum = Frustum;
-    var Ray = (function () {
-        function Ray(origin, direction, length) {
-            if (length === void 0) { length = Number.MAX_VALUE; }
-            this.origin = origin;
-            this.direction = direction;
-            this.length = length;
-        }
-        // Methods
-        Ray.prototype.intersectsBoxMinMax = function (minimum, maximum) {
-            var d = 0.0;
-            var maxValue = Number.MAX_VALUE;
-            var inv;
-            var min;
-            var max;
-            var temp;
-            if (Math.abs(this.direction.x) < 0.0000001) {
-                if (this.origin.x < minimum.x || this.origin.x > maximum.x) {
-                    return false;
-                }
-            }
-            else {
-                inv = 1.0 / this.direction.x;
-                min = (minimum.x - this.origin.x) * inv;
-                max = (maximum.x - this.origin.x) * inv;
-                if (max === -Infinity) {
-                    max = Infinity;
-                }
-                if (min > max) {
-                    temp = min;
-                    min = max;
-                    max = temp;
-                }
-                d = Math.max(min, d);
-                maxValue = Math.min(max, maxValue);
-                if (d > maxValue) {
-                    return false;
-                }
-            }
-            if (Math.abs(this.direction.y) < 0.0000001) {
-                if (this.origin.y < minimum.y || this.origin.y > maximum.y) {
-                    return false;
-                }
-            }
-            else {
-                inv = 1.0 / this.direction.y;
-                min = (minimum.y - this.origin.y) * inv;
-                max = (maximum.y - this.origin.y) * inv;
-                if (max === -Infinity) {
-                    max = Infinity;
-                }
-                if (min > max) {
-                    temp = min;
-                    min = max;
-                    max = temp;
-                }
-                d = Math.max(min, d);
-                maxValue = Math.min(max, maxValue);
-                if (d > maxValue) {
-                    return false;
-                }
-            }
-            if (Math.abs(this.direction.z) < 0.0000001) {
-                if (this.origin.z < minimum.z || this.origin.z > maximum.z) {
-                    return false;
-                }
-            }
-            else {
-                inv = 1.0 / this.direction.z;
-                min = (minimum.z - this.origin.z) * inv;
-                max = (maximum.z - this.origin.z) * inv;
-                if (max === -Infinity) {
-                    max = Infinity;
-                }
-                if (min > max) {
-                    temp = min;
-                    min = max;
-                    max = temp;
-                }
-                d = Math.max(min, d);
-                maxValue = Math.min(max, maxValue);
-                if (d > maxValue) {
-                    return false;
-                }
-            }
-            return true;
-        };
-        Ray.prototype.intersectsBox = function (box) {
-            return this.intersectsBoxMinMax(box.minimum, box.maximum);
-        };
-        Ray.prototype.intersectsSphere = function (sphere) {
-            var x = sphere.center.x - this.origin.x;
-            var y = sphere.center.y - this.origin.y;
-            var z = sphere.center.z - this.origin.z;
-            var pyth = (x * x) + (y * y) + (z * z);
-            var rr = sphere.radius * sphere.radius;
-            if (pyth <= rr) {
-                return true;
-            }
-            var dot = (x * this.direction.x) + (y * this.direction.y) + (z * this.direction.z);
-            if (dot < 0.0) {
-                return false;
-            }
-            var temp = pyth - (dot * dot);
-            return temp <= rr;
-        };
-        Ray.prototype.intersectsTriangle = function (vertex0, vertex1, vertex2) {
-            if (!this._edge1) {
-                this._edge1 = Vector3.Zero();
-                this._edge2 = Vector3.Zero();
-                this._pvec = Vector3.Zero();
-                this._tvec = Vector3.Zero();
-                this._qvec = Vector3.Zero();
-            }
-            vertex1.subtractToRef(vertex0, this._edge1);
-            vertex2.subtractToRef(vertex0, this._edge2);
-            Vector3.CrossToRef(this.direction, this._edge2, this._pvec);
-            var det = Vector3.Dot(this._edge1, this._pvec);
-            if (det === 0) {
-                return null;
-            }
-            var invdet = 1 / det;
-            this.origin.subtractToRef(vertex0, this._tvec);
-            var bu = Vector3.Dot(this._tvec, this._pvec) * invdet;
-            if (bu < 0 || bu > 1.0) {
-                return null;
-            }
-            Vector3.CrossToRef(this._tvec, this._edge1, this._qvec);
-            var bv = Vector3.Dot(this.direction, this._qvec) * invdet;
-            if (bv < 0 || bu + bv > 1.0) {
-                return null;
-            }
-            //check if the distance is longer than the predefined length.
-            var distance = Vector3.Dot(this._edge2, this._qvec) * invdet;
-            if (distance > this.length) {
-                return null;
-            }
-            return new BABYLON.IntersectionInfo(bu, bv, distance);
-        };
-        // Statics
-        Ray.CreateNew = function (x, y, viewportWidth, viewportHeight, world, view, projection) {
-            var start = Vector3.Unproject(new Vector3(x, y, 0), viewportWidth, viewportHeight, world, view, projection);
-            var end = Vector3.Unproject(new Vector3(x, y, 1), viewportWidth, viewportHeight, world, view, projection);
-            var direction = end.subtract(start);
-            direction.normalize();
-            return new Ray(start, direction);
-        };
-        /**
-        * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be
-        * transformed to the given world matrix.
-        * @param origin The origin point
-        * @param end The end point
-        * @param world a matrix to transform the ray to. Default is the identity matrix.
-        */
-        Ray.CreateNewFromTo = function (origin, end, world) {
-            if (world === void 0) { world = Matrix.Identity(); }
-            var direction = end.subtract(origin);
-            var length = Math.sqrt((direction.x * direction.x) + (direction.y * direction.y) + (direction.z * direction.z));
-            direction.normalize();
-            return Ray.Transform(new Ray(origin, direction, length), world);
-        };
-        Ray.Transform = function (ray, matrix) {
-            var newOrigin = Vector3.TransformCoordinates(ray.origin, matrix);
-            var newDirection = Vector3.TransformNormal(ray.direction, matrix);
-            return new Ray(newOrigin, newDirection, ray.length);
-        };
-        return Ray;
-    })();
-    BABYLON.Ray = Ray;
     (function (Space) {
         Space[Space["LOCAL"] = 0] = "LOCAL";
         Space[Space["WORLD"] = 1] = "WORLD";
@@ -2574,63 +2418,6 @@ var BABYLON;
         return Arc2;
     })();
     BABYLON.Arc2 = Arc2;
-    var PathCursor = (function () {
-        function PathCursor(path) {
-            this.path = path;
-            this._onchange = new Array();
-            this.value = 0;
-            this.animations = new Array();
-        }
-        PathCursor.prototype.getPoint = function () {
-            var point = this.path.getPointAtLengthPosition(this.value);
-            return new Vector3(point.x, 0, point.y);
-        };
-        PathCursor.prototype.moveAhead = function (step) {
-            if (step === void 0) { step = 0.002; }
-            this.move(step);
-            return this;
-        };
-        PathCursor.prototype.moveBack = function (step) {
-            if (step === void 0) { step = 0.002; }
-            this.move(-step);
-            return this;
-        };
-        PathCursor.prototype.move = function (step) {
-            if (Math.abs(step) > 1) {
-                throw "step size should be less than 1.";
-            }
-            this.value += step;
-            this.ensureLimits();
-            this.raiseOnChange();
-            return this;
-        };
-        PathCursor.prototype.ensureLimits = function () {
-            while (this.value > 1) {
-                this.value -= 1;
-            }
-            while (this.value < 0) {
-                this.value += 1;
-            }
-            return this;
-        };
-        // used by animation engine
-        PathCursor.prototype.markAsDirty = function (propertyName) {
-            this.ensureLimits();
-            this.raiseOnChange();
-            return this;
-        };
-        PathCursor.prototype.raiseOnChange = function () {
-            var _this = this;
-            this._onchange.forEach(function (f) { return f(_this); });
-            return this;
-        };
-        PathCursor.prototype.onchange = function (f) {
-            this._onchange.push(f);
-            return this;
-        };
-        return PathCursor;
-    })();
-    BABYLON.PathCursor = PathCursor;
     var Path2 = (function () {
         function Path2(x, y) {
             this._points = new Array();
@@ -2842,13 +2629,13 @@ var BABYLON;
             var normal0;
             if (va === undefined || va === null) {
                 var point;
-                if (!BABYLON.Tools.WithinEpsilon(vt.y, 1, BABYLON.Engine.Epsilon)) {
+                if (!MathTools.WithinEpsilon(vt.y, 1, BABYLON.Epsilon)) {
                     point = new Vector3(0, -1, 0);
                 }
-                else if (!BABYLON.Tools.WithinEpsilon(vt.x, 1, BABYLON.Engine.Epsilon)) {
+                else if (!MathTools.WithinEpsilon(vt.x, 1, BABYLON.Epsilon)) {
                     point = new Vector3(1, 0, 0);
                 }
-                else if (!BABYLON.Tools.WithinEpsilon(vt.z, 1, BABYLON.Engine.Epsilon)) {
+                else if (!MathTools.WithinEpsilon(vt.z, 1, BABYLON.Epsilon)) {
                     point = new Vector3(0, 0, 1);
                 }
                 normal0 = Vector3.Cross(vt, point);

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

@@ -3463,6 +3463,4 @@
             Matrix.Zero(), Matrix.Zero(),
             Matrix.Zero(), Matrix.Zero()];                      // 6 temp Matrices at once should be enough
     }
-}
-
-
+}

+ 3 - 3
src/Mesh/babylon.abstractMesh.js

@@ -526,11 +526,11 @@ var BABYLON;
                 }
                 if ((this.billboardMode & AbstractMesh.BILLBOARDMODE_ALL) !== AbstractMesh.BILLBOARDMODE_ALL) {
                     if (this.billboardMode & AbstractMesh.BILLBOARDMODE_X)
-                        zero.x = localPosition.x + BABYLON.Engine.Epsilon;
+                        zero.x = localPosition.x + BABYLON.Epsilon;
                     if (this.billboardMode & AbstractMesh.BILLBOARDMODE_Y)
-                        zero.y = localPosition.y + 0.001;
+                        zero.y = localPosition.y + BABYLON.Epsilon;
                     if (this.billboardMode & AbstractMesh.BILLBOARDMODE_Z)
-                        zero.z = localPosition.z + 0.001;
+                        zero.z = localPosition.z + BABYLON.Epsilon;
                 }
                 BABYLON.Matrix.LookAtLHToRef(localPosition, zero, BABYLON.Vector3.Up(), BABYLON.Tmp.Matrix[3]);
                 BABYLON.Tmp.Matrix[3].m[12] = BABYLON.Tmp.Matrix[3].m[13] = BABYLON.Tmp.Matrix[3].m[14] = 0;

+ 1 - 1
src/Mesh/babylon.mesh.js

@@ -1245,7 +1245,7 @@ var BABYLON;
                 BABYLON.Node.ParseAnimationRanges(mesh, parsedMesh, scene);
             }
             if (parsedMesh.autoAnimate) {
-                scene.beginAnimation(mesh, parsedMesh.autoAnimateFrom, parsedMesh.autoAnimateTo, parsedMesh.autoAnimateLoop, 1.0);
+                scene.beginAnimation(mesh, parsedMesh.autoAnimateFrom, parsedMesh.autoAnimateTo, parsedMesh.autoAnimateLoop, parsedMesh.autoAnimateSpeed || 1.0);
             }
             // Layer Mask
             if (parsedMesh.layerMask && (!isNaN(parsedMesh.layerMask))) {

+ 1 - 1
src/Mesh/babylon.mesh.ts

@@ -1472,7 +1472,7 @@
             }
 
             if (parsedMesh.autoAnimate) {
-                scene.beginAnimation(mesh, parsedMesh.autoAnimateFrom, parsedMesh.autoAnimateTo, parsedMesh.autoAnimateLoop, 1.0);
+                scene.beginAnimation(mesh, parsedMesh.autoAnimateFrom, parsedMesh.autoAnimateTo, parsedMesh.autoAnimateLoop, parsedMesh.autoAnimateSpeed || 1.0);
             }
 
             // Layer Mask

+ 1 - 1
src/Mesh/babylon.meshSimplification.js

@@ -181,7 +181,7 @@ var BABYLON;
             this.syncIterations = 5000;
             this.aggressiveness = 7;
             this.decimationIterations = 100;
-            this.boundingBoxEpsilon = BABYLON.Engine.Epsilon;
+            this.boundingBoxEpsilon = BABYLON.Epsilon;
         }
         QuadraticErrorSimplification.prototype.simplify = function (settings, successCallback) {
             var _this = this;

+ 3 - 0
src/Particles/babylon.particleSystem.js

@@ -397,6 +397,9 @@ var BABYLON;
                     particleSystem.animations.push(BABYLON.Animation.Parse(parsedAnimation));
                 }
             }
+            if (parsedParticleSystem.autoAnimate) {
+                scene.beginAnimation(particleSystem, parsedParticleSystem.autoAnimateFrom, parsedParticleSystem.autoAnimateTo, parsedParticleSystem.autoAnimateLoop, parsedParticleSystem.autoAnimateSpeed || 1.0);
+            }
             // Particle system
             particleSystem.minAngularSpeed = parsedParticleSystem.minAngularSpeed;
             particleSystem.maxAngularSpeed = parsedParticleSystem.maxAngularSpeed;

+ 4 - 0
src/Particles/babylon.particleSystem.ts

@@ -524,6 +524,10 @@
                 }
             }
 
+            if (parsedParticleSystem.autoAnimate) {
+                scene.beginAnimation(particleSystem, parsedParticleSystem.autoAnimateFrom, parsedParticleSystem.autoAnimateTo, parsedParticleSystem.autoAnimateLoop, parsedParticleSystem.autoAnimateSpeed || 1.0);
+            }
+
             // Particle system
             particleSystem.minAngularSpeed = parsedParticleSystem.minAngularSpeed;
             particleSystem.maxAngularSpeed = parsedParticleSystem.maxAngularSpeed;

+ 4 - 0
src/Physics/Plugins/babylon.cannonJSPlugin.js

@@ -371,6 +371,10 @@ var BABYLON;
         CannonJSPlugin.prototype.setAngularVelocity = function (impostor, velocity) {
             impostor.physicsBody.angularVelocity.copy(velocity);
         };
+        CannonJSPlugin.prototype.setBodyMass = function (impostor, mass) {
+            impostor.physicsBody.mass = mass;
+            impostor.physicsBody.updateMassProperties();
+        };
         CannonJSPlugin.prototype.sleepBody = function (impostor) {
             impostor.physicsBody.sleep();
         };

+ 1 - 2
src/Physics/Plugins/babylon.cannonJSPlugin.ts

@@ -434,7 +434,7 @@
         public setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3) {
             impostor.physicsBody.angularVelocity.copy(velocity);
         }
-        
+
         public setBodyMass(impostor: PhysicsImpostor, mass: number) {
             impostor.physicsBody.mass = mass;
             impostor.physicsBody.updateMassProperties();
@@ -454,4 +454,3 @@
     }
 }
 
-

+ 7 - 0
src/Physics/Plugins/babylon.oimoJSPlugin.js

@@ -264,6 +264,13 @@ var BABYLON;
         OimoJSPlugin.prototype.setAngularVelocity = function (impostor, velocity) {
             impostor.physicsBody.angularVelocity.init(velocity.x, velocity.y, velocity.z);
         };
+        OimoJSPlugin.prototype.setBodyMass = function (impostor, mass) {
+            var staticBody = mass === 0;
+            //this will actually set the body's density and not its mass.
+            //But this is how oimo treats the mass variable.
+            impostor.physicsBody.shapes.density = staticBody ? 1 : mass;
+            impostor.physicsBody.setupMass(staticBody ? 0x2 : 0x1);
+        };
         OimoJSPlugin.prototype.sleepBody = function (impostor) {
             impostor.physicsBody.sleep();
         };

+ 3 - 3
src/Physics/Plugins/babylon.oimoJSPlugin.ts

@@ -323,13 +323,13 @@ module BABYLON {
         public setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3) {
             impostor.physicsBody.angularVelocity.init(velocity.x, velocity.y, velocity.z);
         }
-        
-        
+
+
         public setBodyMass(impostor: PhysicsImpostor, mass: number) {
             var staticBody: boolean = mass === 0;
             //this will actually set the body's density and not its mass.
             //But this is how oimo treats the mass variable.
-            impostor.physicsBody.shapes.density = staticBody ? 1 : mass ;
+            impostor.physicsBody.shapes.density = staticBody ? 1 : mass;
             impostor.physicsBody.setupMass(staticBody ? 0x2 : 0x1);
         }
 

+ 9 - 0
src/Physics/babylon.physicsImpostor.js

@@ -157,6 +157,15 @@ var BABYLON;
             this._bodyUpdateRequired = true;
         };
         /**
+         * Specifically change the body's mass option. Won't recreate the physics body object
+         */
+        PhysicsImpostor.prototype.setMass = function (mass) {
+            if (this.getParam("mass") !== mass) {
+                this.setParam("mass", mass);
+            }
+            this._physicsEngine.getPhysicsPlugin().setBodyMass(this, mass);
+        };
+        /**
          * Set the body's linear velocity.
          */
         PhysicsImpostor.prototype.setLinearVelocity = function (velocity) {

+ 1 - 1
src/Physics/babylon.physicsImpostor.ts

@@ -137,7 +137,7 @@ module BABYLON {
          * Specifically change the body's mass option. Won't recreate the physics body object
          */
         public setMass(mass: number) {
-            if(this.getParam("mass") !== mass) {
+            if (this.getParam("mass") !== mass) {
                 this.setParam("mass", mass);
             }
             this._physicsEngine.getPhysicsPlugin().setBodyMass(this, mass);

+ 0 - 5
src/Tools/babylon.tools.js

@@ -374,11 +374,6 @@ var BABYLON;
             if (v.z > max.z)
                 max.z = v.z;
         };
-        Tools.WithinEpsilon = function (a, b, epsilon) {
-            if (epsilon === void 0) { epsilon = 1.401298E-45; }
-            var num = a - b;
-            return -epsilon <= num && num <= epsilon;
-        };
         Tools.DeepCopy = function (source, destination, doNotCopyList, mustCopyList) {
             for (var prop in source) {
                 if (prop[0] === "_" && (!mustCopyList || mustCopyList.indexOf(prop) === -1)) {

+ 1 - 1
src/Tools/babylon.tools.ts

@@ -453,7 +453,7 @@
             if (v.z > max.z)
                 max.z = v.z;
         }
-
+        
         public static DeepCopy(source, destination, doNotCopyList?: string[], mustCopyList?: string[]): void {
             for (var prop in source) {
 

+ 0 - 1
src/babylon.engine.js

@@ -1936,7 +1936,6 @@ var BABYLON;
         Engine._TEXTURETYPE_UNSIGNED_INT = 0;
         Engine._TEXTURETYPE_FLOAT = 1;
         // Updatable statics so stick with vars here
-        Engine.Epsilon = 0.001;
         Engine.CollisionsEpsilon = 0.001;
         Engine.CodeRepository = "src/";
         Engine.ShadersRepository = "src/Shaders/";