Prechádzať zdrojové kódy

Nightly + fix animation bugs

David Catuhe 7 rokov pred
rodič
commit
68317ae63a

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 3297 - 3291
Playground/babylon.d.txt


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 9864 - 9858
dist/preview release/babylon.d.ts


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 34 - 34
dist/preview release/babylon.js


+ 100 - 58
dist/preview release/babylon.max.js

@@ -18814,7 +18814,7 @@ var BABYLON;
                 this.actionManager = null;
             }
             // Skeleton
-            this.skeleton = null;
+            this._skeleton = null;
             // Physics
             if (this.physicsImpostor) {
                 this.physicsImpostor.dispose();
@@ -21677,16 +21677,19 @@ var BABYLON;
             * @type {BABYLON.Observable}
             */
             this.onDisposeObservable = new BABYLON.Observable();
+            this._onDisposeObserver = null;
             /**
             * An event triggered before rendering the scene (right after animations and physics)
             * @type {BABYLON.Observable}
             */
             this.onBeforeRenderObservable = new BABYLON.Observable();
+            this._onBeforeRenderObserver = null;
             /**
             * An event triggered after rendering the scene
             * @type {BABYLON.Observable}
             */
             this.onAfterRenderObservable = new BABYLON.Observable();
+            this._onAfterRenderObserver = null;
             /**
             * An event triggered before animating the scene
             * @type {BABYLON.Observable}
@@ -21727,11 +21730,13 @@ var BABYLON;
             * @type {BABYLON.Observable}
             */
             this.onBeforeCameraRenderObservable = new BABYLON.Observable();
+            this._onBeforeCameraRenderObserver = null;
             /**
             * An event triggered after rendering a camera
             * @type {BABYLON.Observable}
             */
             this.onAfterCameraRenderObservable = new BABYLON.Observable();
+            this._onAfterCameraRenderObserver = null;
             /**
             * An event triggered when active meshes evaluation is about to start
             * @type {BABYLON.Observable}
@@ -23440,9 +23445,7 @@ var BABYLON;
                     this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent);
                 }
             }
-            if (stopCurrent) {
-                animatable.reset();
-            }
+            animatable.reset();
             return animatable;
         };
         /**
@@ -23492,6 +23495,20 @@ var BABYLON;
             }
             return null;
         };
+        /**
+         * Gets all animatables associated with a given target
+         * @param target defines the target to look animatables for
+         * @returns an array of Animatables
+         */
+        Scene.prototype.getAllAnimatablesByTarget = function (target) {
+            var result = [];
+            for (var index = 0; index < this._activeAnimatables.length; index++) {
+                if (this._activeAnimatables[index].target === target) {
+                    result.push(this._activeAnimatables[index]);
+                }
+            }
+            return result;
+        };
         Object.defineProperty(Scene.prototype, "animatables", {
             get: function () {
                 return this._activeAnimatables;
@@ -23502,12 +23519,13 @@ var BABYLON;
         /**
          * Will stop the animation of the given target
          * @param target - the target
-         * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
+         * @param animationName - the name of the animation to stop (all animations will be stopped if empty)
          * @see beginAnimation
          */
         Scene.prototype.stopAnimation = function (target, animationName) {
-            var animatable = this.getAnimatableByTarget(target);
-            if (animatable) {
+            var animatables = this.getAllAnimatablesByTarget(target);
+            for (var _i = 0, animatables_1 = animatables; _i < animatables_1.length; _i++) {
+                var animatable = animatables_1[_i];
                 animatable.stop(animationName);
             }
         };
@@ -47966,12 +47984,16 @@ var BABYLON;
          * @param scene defines the hosting scene
          */
         function RuntimeAnimation(target, animation, scene) {
+            this.currentFrame = 0;
             this._offsetsCache = {};
             this._highLimitsCache = {};
             this._stopped = false;
             this._blendingFactor = 0;
+            this._targetPath = "";
             this._weight = 1.0;
             this._ratioOffset = 0;
+            this._previousDelay = 0;
+            this._previousRatio = 0;
             this._animation = animation;
             this._target = target;
             this._scene = scene;
@@ -48183,7 +48205,7 @@ var BABYLON;
                 for (var index = 1; index < targetPropertyPath.length - 1; index++) {
                     property = property[targetPropertyPath[index]];
                 }
-                path = [targetPropertyPath.length - 1];
+                path = targetPropertyPath[targetPropertyPath.length - 1];
                 destination = property;
             }
             else {
@@ -48196,7 +48218,18 @@ var BABYLON;
             // Blending
             var enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
-            if (enableBlending && this._blendingFactor <= 1.0 || weight !== -1.0) {
+            if (enableBlending && this._blendingFactor <= 1.0) {
+                if (!this._originalBlendValue) {
+                    var originalValue = destination[path];
+                    if (originalValue.clone) {
+                        this._originalBlendValue = originalValue.clone();
+                    }
+                    else {
+                        this._originalBlendValue = originalValue;
+                    }
+                }
+            }
+            if (weight !== -1.0) {
                 if (!this._originalValue) {
                     var originalValue = void 0;
                     if (destination.getRestPose) {
@@ -48214,31 +48247,30 @@ var BABYLON;
                 }
             }
             if (enableBlending && this._blendingFactor <= 1.0) {
-                if (this._originalValue.prototype) {
-                    if (this._originalValue.prototype.Lerp) {
-                        this._currentValue = this._originalValue.construtor.prototype.Lerp(currentValue, this._originalValue, this._blendingFactor);
+                if (this._originalBlendValue.prototype) {
+                    if (this._originalBlendValue.prototype.Lerp) {
+                        this._currentValue = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
                     }
                     else {
                         this._currentValue = currentValue;
                     }
                 }
-                else if (this._originalValue.m) {
-                    this._currentValue = BABYLON.Matrix.Lerp(this._originalValue, currentValue, this._blendingFactor);
+                else if (this._originalBlendValue.m) {
+                    this._currentValue = BABYLON.Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
                 }
                 else {
-                    this._currentValue = this._originalValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
                 this._blendingFactor += blendingSpeed;
-                destination[path] = this._currentValue;
             }
             else {
                 this._currentValue = currentValue;
-                if (weight !== -1.0) {
-                    this._scene._registerTargetForLateAnimationBinding(this);
-                }
-                else {
-                    destination[path] = this._currentValue;
-                }
+            }
+            if (weight !== -1.0) {
+                this._scene._registerTargetForLateAnimationBinding(this);
+            }
+            else {
+                destination[path] = this._currentValue;
             }
             if (this._target.markAsDirty) {
                 this._target.markAsDirty(this._animation.targetProperty);
@@ -48618,6 +48650,9 @@ var BABYLON;
                 this._localDelayOffset += delay - this._pausedDelay;
                 this._pausedDelay = null;
             }
+            if (this._weight === 0) {
+                return true;
+            }
             // Animating
             var running = false;
             var runtimeAnimations = this._runtimeAnimations;
@@ -79449,11 +79484,10 @@ var BABYLON;
             this._tmpImpostorsArray = [];
             this._tmpPositionVector = BABYLON.Vector3.Zero();
             this.BJSOIMO = typeof OIMO !== 'undefined' ? OIMO : (typeof require !== 'undefined' ? require('./Oimo') : undefined);
-            this.world = new this.BJSOIMO.World(1 / 60, 2, iterations, true);
-            this.world.worldscale(1);
+            this.world = new this.BJSOIMO.World({
+                iterations: iterations
+            });
             this.world.clear();
-            //making sure no stats are calculated
-            this.world.isNoStat = true;
         }
         OimoJSPlugin.prototype.setGravity = function (gravity) {
             this.world.gravity.copy(gravity);
@@ -79495,8 +79529,8 @@ var BABYLON;
             }
         };
         OimoJSPlugin.prototype.applyImpulse = function (impostor, force, contactPoint) {
-            var mass = impostor.physicsBody.massInfo.mass;
-            impostor.physicsBody.applyImpulse(contactPoint.scale(this.BJSOIMO.INV_SCALE), force.scale(this.BJSOIMO.INV_SCALE * mass));
+            var mass = impostor.physicsBody.mass;
+            impostor.physicsBody.applyImpulse(contactPoint.scale(this.world.invScale), force.scale(this.world.invScale * mass));
         };
         OimoJSPlugin.prototype.applyForce = function (impostor, force, contactPoint) {
             BABYLON.Tools.Warn("Oimo doesn't support applying force. Using impule instead.");
@@ -79521,8 +79555,13 @@ var BABYLON;
                     size: [],
                     type: [],
                     pos: [],
+                    posShape: [],
                     rot: [],
+                    rotShape: [],
                     move: impostor.getParam("mass") !== 0,
+                    density: impostor.getParam("mass"),
+                    friction: impostor.getParam("friction"),
+                    restitution: impostor.getParam("restitution"),
                     //Supporting older versions of Oimo
                     world: this.world
                 };
@@ -79542,18 +79581,14 @@ var BABYLON;
                     return Math.max(value, BABYLON.PhysicsEngine.Epsilon);
                 };
                 impostors.forEach(function (i) {
-                    if (!impostor.object.rotationQuaternion) {
+                    if (!i.object.rotationQuaternion) {
                         return;
                     }
                     //get the correct bounding box
                     var oldQuaternion = i.object.rotationQuaternion;
-                    var rot = new _this.BJSOIMO.Euler().setFromQuaternion({
-                        x: impostor.object.rotationQuaternion.x,
-                        y: impostor.object.rotationQuaternion.y,
-                        z: impostor.object.rotationQuaternion.z,
-                        s: impostor.object.rotationQuaternion.w
-                    });
+                    var rot = oldQuaternion.toEulerAngles();
                     var extendSize = i.getObjectExtendSize();
+                    var radToDeg = 57.295779513082320876;
                     if (i === impostor) {
                         var center = impostor.getObjectCenter();
                         impostor.object.getAbsolutePivotPoint().subtractToRef(center, _this._tmpPositionVector);
@@ -79562,25 +79597,31 @@ var BABYLON;
                         bodyConfig.pos.push(center.x);
                         bodyConfig.pos.push(center.y);
                         bodyConfig.pos.push(center.z);
+                        bodyConfig.posShape.push(0, 0, 0);
                         //tmp solution
-                        bodyConfig.rot.push(rot.x / (_this.BJSOIMO.degtorad || _this.BJSOIMO.TO_RAD));
-                        bodyConfig.rot.push(rot.y / (_this.BJSOIMO.degtorad || _this.BJSOIMO.TO_RAD));
-                        bodyConfig.rot.push(rot.z / (_this.BJSOIMO.degtorad || _this.BJSOIMO.TO_RAD));
+                        bodyConfig.rot.push(rot.x * radToDeg);
+                        bodyConfig.rot.push(rot.y * radToDeg);
+                        bodyConfig.rot.push(rot.z * radToDeg);
+                        bodyConfig.rotShape.push(0, 0, 0);
                     }
                     else {
                         var localPosition = i.object.getAbsolutePosition().subtract(impostor.object.getAbsolutePosition());
-                        bodyConfig.pos.push(localPosition.x);
-                        bodyConfig.pos.push(localPosition.y);
-                        bodyConfig.pos.push(localPosition.z);
+                        bodyConfig.posShape.push(localPosition.x);
+                        bodyConfig.posShape.push(localPosition.y);
+                        bodyConfig.posShape.push(localPosition.z);
+                        bodyConfig.pos.push(0, 0, 0);
                         //tmp solution until https://github.com/lo-th/OIMO.js/pull/37 is merged
                         bodyConfig.rot.push(0);
                         bodyConfig.rot.push(0);
                         bodyConfig.rot.push(0);
+                        bodyConfig.rotShape.push(rot.x * radToDeg);
+                        bodyConfig.rotShape.push(rot.y * radToDeg);
+                        bodyConfig.rotShape.push(rot.z * radToDeg);
                     }
                     // register mesh
                     switch (i.type) {
                         case BABYLON.PhysicsImpostor.ParticleImpostor:
-                            BABYLON.Tools.Warn("No Particle support in this.BJSOIMO.js. using SphereImpostor instead");
+                            BABYLON.Tools.Warn("No Particle support in OIMO.js. using SphereImpostor instead");
                         case BABYLON.PhysicsImpostor.SphereImpostor:
                             var radiusX = extendSize.x;
                             var radiusY = extendSize.y;
@@ -79608,15 +79649,19 @@ var BABYLON;
                             var sizeY = checkWithEpsilon_1(extendSize.y);
                             var sizeZ = checkWithEpsilon_1(extendSize.z);
                             bodyConfig.type.push('box');
+                            //if (i === impostor) {
                             bodyConfig.size.push(sizeX);
                             bodyConfig.size.push(sizeY);
                             bodyConfig.size.push(sizeZ);
+                            //} else {
+                            //    bodyConfig.size.push(0,0,0);
+                            //}
                             break;
                     }
                     //actually not needed, but hey...
                     i.object.rotationQuaternion = oldQuaternion;
                 });
-                impostor.physicsBody = new this.BJSOIMO.Body(bodyConfig).body; //this.world.add(bodyConfig);
+                impostor.physicsBody = this.world.add(bodyConfig);
             }
             else {
                 this._tmpPositionVector.copyFromFloats(0, 0, 0);
@@ -79658,7 +79703,7 @@ var BABYLON;
                     type = "jointBall";
                     break;
                 case BABYLON.PhysicsJoint.SpringJoint:
-                    BABYLON.Tools.Warn("this.BJSOIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");
+                    BABYLON.Tools.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");
                     var springData = jointData;
                     nativeJointData.min = springData.length || nativeJointData.min;
                     //Max should also be set, just make sure it is at least min
@@ -79682,7 +79727,7 @@ var BABYLON;
                     break;
             }
             nativeJointData.type = type;
-            impostorJoint.joint.physicsJoint = new this.BJSOIMO.Link(nativeJointData).joint; //this.world.add(nativeJointData);
+            impostorJoint.joint.physicsJoint = this.world.add(nativeJointData);
         };
         OimoJSPlugin.prototype.removeJoint = function (impostorJoint) {
             //Bug in Oimo prevents us from disposing a joint in the playground
@@ -79701,35 +79746,32 @@ var BABYLON;
         OimoJSPlugin.prototype.setTransformationFromPhysicsBody = function (impostor) {
             if (!impostor.physicsBody.sleeping) {
                 //TODO check that
-                if (impostor.physicsBody.shapes.next) {
+                /*if (impostor.physicsBody.shapes.next) {
                     var parentShape = this._getLastShape(impostor.physicsBody);
-                    impostor.object.position.x = parentShape.position.x * this.BJSOIMO.WORLD_SCALE;
-                    impostor.object.position.y = parentShape.position.y * this.BJSOIMO.WORLD_SCALE;
-                    impostor.object.position.z = parentShape.position.z * this.BJSOIMO.WORLD_SCALE;
-                }
-                else {
-                    impostor.object.position.copyFrom(impostor.physicsBody.getPosition());
-                }
+                    impostor.object.position.copyFrom(parentShape.position);
+                    console.log(parentShape.position);
+                } else {*/
+                impostor.object.position.copyFrom(impostor.physicsBody.getPosition());
+                //}
                 if (impostor.object.rotationQuaternion) {
                     impostor.object.rotationQuaternion.copyFrom(impostor.physicsBody.getQuaternion());
-                    impostor.object.rotationQuaternion.normalize();
                 }
             }
         };
         OimoJSPlugin.prototype.setPhysicsBodyTransformation = function (impostor, newPosition, newRotation) {
             var body = impostor.physicsBody;
-            body.position.init(newPosition.x * this.BJSOIMO.INV_SCALE, newPosition.y * this.BJSOIMO.INV_SCALE, newPosition.z * this.BJSOIMO.INV_SCALE);
-            body.orientation.init(newRotation.w, newRotation.x, newRotation.y, newRotation.z);
+            body.position.copy(newPosition);
+            body.orientation.copy(newRotation);
             body.syncShapes();
             body.awake();
         };
-        OimoJSPlugin.prototype._getLastShape = function (body) {
+        /*private _getLastShape(body: any): any {
             var lastShape = body.shapes;
             while (lastShape.next) {
                 lastShape = lastShape.next;
             }
             return lastShape;
-        };
+        }*/
         OimoJSPlugin.prototype.setLinearVelocity = function (impostor, velocity) {
             impostor.physicsBody.linearVelocity.init(velocity.x, velocity.y, velocity.z);
         };

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 34 - 34
dist/preview release/babylon.worker.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 5424 - 5418
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 41 - 41
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 99 - 57
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -18814,7 +18814,7 @@ var BABYLON;
                 this.actionManager = null;
             }
             // Skeleton
-            this.skeleton = null;
+            this._skeleton = null;
             // Physics
             if (this.physicsImpostor) {
                 this.physicsImpostor.dispose();
@@ -21677,16 +21677,19 @@ var BABYLON;
             * @type {BABYLON.Observable}
             */
             this.onDisposeObservable = new BABYLON.Observable();
+            this._onDisposeObserver = null;
             /**
             * An event triggered before rendering the scene (right after animations and physics)
             * @type {BABYLON.Observable}
             */
             this.onBeforeRenderObservable = new BABYLON.Observable();
+            this._onBeforeRenderObserver = null;
             /**
             * An event triggered after rendering the scene
             * @type {BABYLON.Observable}
             */
             this.onAfterRenderObservable = new BABYLON.Observable();
+            this._onAfterRenderObserver = null;
             /**
             * An event triggered before animating the scene
             * @type {BABYLON.Observable}
@@ -21727,11 +21730,13 @@ var BABYLON;
             * @type {BABYLON.Observable}
             */
             this.onBeforeCameraRenderObservable = new BABYLON.Observable();
+            this._onBeforeCameraRenderObserver = null;
             /**
             * An event triggered after rendering a camera
             * @type {BABYLON.Observable}
             */
             this.onAfterCameraRenderObservable = new BABYLON.Observable();
+            this._onAfterCameraRenderObserver = null;
             /**
             * An event triggered when active meshes evaluation is about to start
             * @type {BABYLON.Observable}
@@ -23440,9 +23445,7 @@ var BABYLON;
                     this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent);
                 }
             }
-            if (stopCurrent) {
-                animatable.reset();
-            }
+            animatable.reset();
             return animatable;
         };
         /**
@@ -23492,6 +23495,20 @@ var BABYLON;
             }
             return null;
         };
+        /**
+         * Gets all animatables associated with a given target
+         * @param target defines the target to look animatables for
+         * @returns an array of Animatables
+         */
+        Scene.prototype.getAllAnimatablesByTarget = function (target) {
+            var result = [];
+            for (var index = 0; index < this._activeAnimatables.length; index++) {
+                if (this._activeAnimatables[index].target === target) {
+                    result.push(this._activeAnimatables[index]);
+                }
+            }
+            return result;
+        };
         Object.defineProperty(Scene.prototype, "animatables", {
             get: function () {
                 return this._activeAnimatables;
@@ -23502,12 +23519,13 @@ var BABYLON;
         /**
          * Will stop the animation of the given target
          * @param target - the target
-         * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
+         * @param animationName - the name of the animation to stop (all animations will be stopped if empty)
          * @see beginAnimation
          */
         Scene.prototype.stopAnimation = function (target, animationName) {
-            var animatable = this.getAnimatableByTarget(target);
-            if (animatable) {
+            var animatables = this.getAllAnimatablesByTarget(target);
+            for (var _i = 0, animatables_1 = animatables; _i < animatables_1.length; _i++) {
+                var animatable = animatables_1[_i];
                 animatable.stop(animationName);
             }
         };
@@ -47966,12 +47984,16 @@ var BABYLON;
          * @param scene defines the hosting scene
          */
         function RuntimeAnimation(target, animation, scene) {
+            this.currentFrame = 0;
             this._offsetsCache = {};
             this._highLimitsCache = {};
             this._stopped = false;
             this._blendingFactor = 0;
+            this._targetPath = "";
             this._weight = 1.0;
             this._ratioOffset = 0;
+            this._previousDelay = 0;
+            this._previousRatio = 0;
             this._animation = animation;
             this._target = target;
             this._scene = scene;
@@ -48196,7 +48218,18 @@ var BABYLON;
             // Blending
             var enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
-            if (enableBlending && this._blendingFactor <= 1.0 || weight !== -1.0) {
+            if (enableBlending && this._blendingFactor <= 1.0) {
+                if (!this._originalBlendValue) {
+                    var originalValue = destination[path];
+                    if (originalValue.clone) {
+                        this._originalBlendValue = originalValue.clone();
+                    }
+                    else {
+                        this._originalBlendValue = originalValue;
+                    }
+                }
+            }
+            if (weight !== -1.0) {
                 if (!this._originalValue) {
                     var originalValue = void 0;
                     if (destination.getRestPose) {
@@ -48214,31 +48247,30 @@ var BABYLON;
                 }
             }
             if (enableBlending && this._blendingFactor <= 1.0) {
-                if (this._originalValue.prototype) {
-                    if (this._originalValue.prototype.Lerp) {
-                        this._currentValue = this._originalValue.construtor.prototype.Lerp(currentValue, this._originalValue, this._blendingFactor);
+                if (this._originalBlendValue.prototype) {
+                    if (this._originalBlendValue.prototype.Lerp) {
+                        this._currentValue = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
                     }
                     else {
                         this._currentValue = currentValue;
                     }
                 }
-                else if (this._originalValue.m) {
-                    this._currentValue = BABYLON.Matrix.Lerp(this._originalValue, currentValue, this._blendingFactor);
+                else if (this._originalBlendValue.m) {
+                    this._currentValue = BABYLON.Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
                 }
                 else {
-                    this._currentValue = this._originalValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
                 this._blendingFactor += blendingSpeed;
-                destination[path] = this._currentValue;
             }
             else {
                 this._currentValue = currentValue;
-                if (weight !== -1.0) {
-                    this._scene._registerTargetForLateAnimationBinding(this);
-                }
-                else {
-                    destination[path] = this._currentValue;
-                }
+            }
+            if (weight !== -1.0) {
+                this._scene._registerTargetForLateAnimationBinding(this);
+            }
+            else {
+                destination[path] = this._currentValue;
             }
             if (this._target.markAsDirty) {
                 this._target.markAsDirty(this._animation.targetProperty);
@@ -48618,6 +48650,9 @@ var BABYLON;
                 this._localDelayOffset += delay - this._pausedDelay;
                 this._pausedDelay = null;
             }
+            if (this._weight === 0) {
+                return true;
+            }
             // Animating
             var running = false;
             var runtimeAnimations = this._runtimeAnimations;
@@ -78738,11 +78773,10 @@ var BABYLON;
             this._tmpImpostorsArray = [];
             this._tmpPositionVector = BABYLON.Vector3.Zero();
             this.BJSOIMO = typeof OIMO !== 'undefined' ? OIMO : (typeof require !== 'undefined' ? require('./Oimo') : undefined);
-            this.world = new this.BJSOIMO.World(1 / 60, 2, iterations, true);
-            this.world.worldscale(1);
+            this.world = new this.BJSOIMO.World({
+                iterations: iterations
+            });
             this.world.clear();
-            //making sure no stats are calculated
-            this.world.isNoStat = true;
         }
         OimoJSPlugin.prototype.setGravity = function (gravity) {
             this.world.gravity.copy(gravity);
@@ -78784,8 +78818,8 @@ var BABYLON;
             }
         };
         OimoJSPlugin.prototype.applyImpulse = function (impostor, force, contactPoint) {
-            var mass = impostor.physicsBody.massInfo.mass;
-            impostor.physicsBody.applyImpulse(contactPoint.scale(this.BJSOIMO.INV_SCALE), force.scale(this.BJSOIMO.INV_SCALE * mass));
+            var mass = impostor.physicsBody.mass;
+            impostor.physicsBody.applyImpulse(contactPoint.scale(this.world.invScale), force.scale(this.world.invScale * mass));
         };
         OimoJSPlugin.prototype.applyForce = function (impostor, force, contactPoint) {
             BABYLON.Tools.Warn("Oimo doesn't support applying force. Using impule instead.");
@@ -78810,8 +78844,13 @@ var BABYLON;
                     size: [],
                     type: [],
                     pos: [],
+                    posShape: [],
                     rot: [],
+                    rotShape: [],
                     move: impostor.getParam("mass") !== 0,
+                    density: impostor.getParam("mass"),
+                    friction: impostor.getParam("friction"),
+                    restitution: impostor.getParam("restitution"),
                     //Supporting older versions of Oimo
                     world: this.world
                 };
@@ -78831,18 +78870,14 @@ var BABYLON;
                     return Math.max(value, BABYLON.PhysicsEngine.Epsilon);
                 };
                 impostors.forEach(function (i) {
-                    if (!impostor.object.rotationQuaternion) {
+                    if (!i.object.rotationQuaternion) {
                         return;
                     }
                     //get the correct bounding box
                     var oldQuaternion = i.object.rotationQuaternion;
-                    var rot = new _this.BJSOIMO.Euler().setFromQuaternion({
-                        x: impostor.object.rotationQuaternion.x,
-                        y: impostor.object.rotationQuaternion.y,
-                        z: impostor.object.rotationQuaternion.z,
-                        s: impostor.object.rotationQuaternion.w
-                    });
+                    var rot = oldQuaternion.toEulerAngles();
                     var extendSize = i.getObjectExtendSize();
+                    var radToDeg = 57.295779513082320876;
                     if (i === impostor) {
                         var center = impostor.getObjectCenter();
                         impostor.object.getAbsolutePivotPoint().subtractToRef(center, _this._tmpPositionVector);
@@ -78851,25 +78886,31 @@ var BABYLON;
                         bodyConfig.pos.push(center.x);
                         bodyConfig.pos.push(center.y);
                         bodyConfig.pos.push(center.z);
+                        bodyConfig.posShape.push(0, 0, 0);
                         //tmp solution
-                        bodyConfig.rot.push(rot.x / (_this.BJSOIMO.degtorad || _this.BJSOIMO.TO_RAD));
-                        bodyConfig.rot.push(rot.y / (_this.BJSOIMO.degtorad || _this.BJSOIMO.TO_RAD));
-                        bodyConfig.rot.push(rot.z / (_this.BJSOIMO.degtorad || _this.BJSOIMO.TO_RAD));
+                        bodyConfig.rot.push(rot.x * radToDeg);
+                        bodyConfig.rot.push(rot.y * radToDeg);
+                        bodyConfig.rot.push(rot.z * radToDeg);
+                        bodyConfig.rotShape.push(0, 0, 0);
                     }
                     else {
                         var localPosition = i.object.getAbsolutePosition().subtract(impostor.object.getAbsolutePosition());
-                        bodyConfig.pos.push(localPosition.x);
-                        bodyConfig.pos.push(localPosition.y);
-                        bodyConfig.pos.push(localPosition.z);
+                        bodyConfig.posShape.push(localPosition.x);
+                        bodyConfig.posShape.push(localPosition.y);
+                        bodyConfig.posShape.push(localPosition.z);
+                        bodyConfig.pos.push(0, 0, 0);
                         //tmp solution until https://github.com/lo-th/OIMO.js/pull/37 is merged
                         bodyConfig.rot.push(0);
                         bodyConfig.rot.push(0);
                         bodyConfig.rot.push(0);
+                        bodyConfig.rotShape.push(rot.x * radToDeg);
+                        bodyConfig.rotShape.push(rot.y * radToDeg);
+                        bodyConfig.rotShape.push(rot.z * radToDeg);
                     }
                     // register mesh
                     switch (i.type) {
                         case BABYLON.PhysicsImpostor.ParticleImpostor:
-                            BABYLON.Tools.Warn("No Particle support in this.BJSOIMO.js. using SphereImpostor instead");
+                            BABYLON.Tools.Warn("No Particle support in OIMO.js. using SphereImpostor instead");
                         case BABYLON.PhysicsImpostor.SphereImpostor:
                             var radiusX = extendSize.x;
                             var radiusY = extendSize.y;
@@ -78897,15 +78938,19 @@ var BABYLON;
                             var sizeY = checkWithEpsilon_1(extendSize.y);
                             var sizeZ = checkWithEpsilon_1(extendSize.z);
                             bodyConfig.type.push('box');
+                            //if (i === impostor) {
                             bodyConfig.size.push(sizeX);
                             bodyConfig.size.push(sizeY);
                             bodyConfig.size.push(sizeZ);
+                            //} else {
+                            //    bodyConfig.size.push(0,0,0);
+                            //}
                             break;
                     }
                     //actually not needed, but hey...
                     i.object.rotationQuaternion = oldQuaternion;
                 });
-                impostor.physicsBody = new this.BJSOIMO.Body(bodyConfig).body; //this.world.add(bodyConfig);
+                impostor.physicsBody = this.world.add(bodyConfig);
             }
             else {
                 this._tmpPositionVector.copyFromFloats(0, 0, 0);
@@ -78947,7 +78992,7 @@ var BABYLON;
                     type = "jointBall";
                     break;
                 case BABYLON.PhysicsJoint.SpringJoint:
-                    BABYLON.Tools.Warn("this.BJSOIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");
+                    BABYLON.Tools.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");
                     var springData = jointData;
                     nativeJointData.min = springData.length || nativeJointData.min;
                     //Max should also be set, just make sure it is at least min
@@ -78971,7 +79016,7 @@ var BABYLON;
                     break;
             }
             nativeJointData.type = type;
-            impostorJoint.joint.physicsJoint = new this.BJSOIMO.Link(nativeJointData).joint; //this.world.add(nativeJointData);
+            impostorJoint.joint.physicsJoint = this.world.add(nativeJointData);
         };
         OimoJSPlugin.prototype.removeJoint = function (impostorJoint) {
             //Bug in Oimo prevents us from disposing a joint in the playground
@@ -78990,35 +79035,32 @@ var BABYLON;
         OimoJSPlugin.prototype.setTransformationFromPhysicsBody = function (impostor) {
             if (!impostor.physicsBody.sleeping) {
                 //TODO check that
-                if (impostor.physicsBody.shapes.next) {
+                /*if (impostor.physicsBody.shapes.next) {
                     var parentShape = this._getLastShape(impostor.physicsBody);
-                    impostor.object.position.x = parentShape.position.x * this.BJSOIMO.WORLD_SCALE;
-                    impostor.object.position.y = parentShape.position.y * this.BJSOIMO.WORLD_SCALE;
-                    impostor.object.position.z = parentShape.position.z * this.BJSOIMO.WORLD_SCALE;
-                }
-                else {
-                    impostor.object.position.copyFrom(impostor.physicsBody.getPosition());
-                }
+                    impostor.object.position.copyFrom(parentShape.position);
+                    console.log(parentShape.position);
+                } else {*/
+                impostor.object.position.copyFrom(impostor.physicsBody.getPosition());
+                //}
                 if (impostor.object.rotationQuaternion) {
                     impostor.object.rotationQuaternion.copyFrom(impostor.physicsBody.getQuaternion());
-                    impostor.object.rotationQuaternion.normalize();
                 }
             }
         };
         OimoJSPlugin.prototype.setPhysicsBodyTransformation = function (impostor, newPosition, newRotation) {
             var body = impostor.physicsBody;
-            body.position.init(newPosition.x * this.BJSOIMO.INV_SCALE, newPosition.y * this.BJSOIMO.INV_SCALE, newPosition.z * this.BJSOIMO.INV_SCALE);
-            body.orientation.init(newRotation.w, newRotation.x, newRotation.y, newRotation.z);
+            body.position.copy(newPosition);
+            body.orientation.copy(newRotation);
             body.syncShapes();
             body.awake();
         };
-        OimoJSPlugin.prototype._getLastShape = function (body) {
+        /*private _getLastShape(body: any): any {
             var lastShape = body.shapes;
             while (lastShape.next) {
                 lastShape = lastShape.next;
             }
             return lastShape;
-        };
+        }*/
         OimoJSPlugin.prototype.setLinearVelocity = function (impostor, velocity) {
             impostor.physicsBody.linearVelocity.init(velocity.x, velocity.y, velocity.z);
         };

+ 99 - 57
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -18787,7 +18787,7 @@ var BABYLON;
                 this.actionManager = null;
             }
             // Skeleton
-            this.skeleton = null;
+            this._skeleton = null;
             // Physics
             if (this.physicsImpostor) {
                 this.physicsImpostor.dispose();
@@ -21650,16 +21650,19 @@ var BABYLON;
             * @type {BABYLON.Observable}
             */
             this.onDisposeObservable = new BABYLON.Observable();
+            this._onDisposeObserver = null;
             /**
             * An event triggered before rendering the scene (right after animations and physics)
             * @type {BABYLON.Observable}
             */
             this.onBeforeRenderObservable = new BABYLON.Observable();
+            this._onBeforeRenderObserver = null;
             /**
             * An event triggered after rendering the scene
             * @type {BABYLON.Observable}
             */
             this.onAfterRenderObservable = new BABYLON.Observable();
+            this._onAfterRenderObserver = null;
             /**
             * An event triggered before animating the scene
             * @type {BABYLON.Observable}
@@ -21700,11 +21703,13 @@ var BABYLON;
             * @type {BABYLON.Observable}
             */
             this.onBeforeCameraRenderObservable = new BABYLON.Observable();
+            this._onBeforeCameraRenderObserver = null;
             /**
             * An event triggered after rendering a camera
             * @type {BABYLON.Observable}
             */
             this.onAfterCameraRenderObservable = new BABYLON.Observable();
+            this._onAfterCameraRenderObserver = null;
             /**
             * An event triggered when active meshes evaluation is about to start
             * @type {BABYLON.Observable}
@@ -23413,9 +23418,7 @@ var BABYLON;
                     this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent);
                 }
             }
-            if (stopCurrent) {
-                animatable.reset();
-            }
+            animatable.reset();
             return animatable;
         };
         /**
@@ -23465,6 +23468,20 @@ var BABYLON;
             }
             return null;
         };
+        /**
+         * Gets all animatables associated with a given target
+         * @param target defines the target to look animatables for
+         * @returns an array of Animatables
+         */
+        Scene.prototype.getAllAnimatablesByTarget = function (target) {
+            var result = [];
+            for (var index = 0; index < this._activeAnimatables.length; index++) {
+                if (this._activeAnimatables[index].target === target) {
+                    result.push(this._activeAnimatables[index]);
+                }
+            }
+            return result;
+        };
         Object.defineProperty(Scene.prototype, "animatables", {
             get: function () {
                 return this._activeAnimatables;
@@ -23475,12 +23492,13 @@ var BABYLON;
         /**
          * Will stop the animation of the given target
          * @param target - the target
-         * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
+         * @param animationName - the name of the animation to stop (all animations will be stopped if empty)
          * @see beginAnimation
          */
         Scene.prototype.stopAnimation = function (target, animationName) {
-            var animatable = this.getAnimatableByTarget(target);
-            if (animatable) {
+            var animatables = this.getAllAnimatablesByTarget(target);
+            for (var _i = 0, animatables_1 = animatables; _i < animatables_1.length; _i++) {
+                var animatable = animatables_1[_i];
                 animatable.stop(animationName);
             }
         };
@@ -47939,12 +47957,16 @@ var BABYLON;
          * @param scene defines the hosting scene
          */
         function RuntimeAnimation(target, animation, scene) {
+            this.currentFrame = 0;
             this._offsetsCache = {};
             this._highLimitsCache = {};
             this._stopped = false;
             this._blendingFactor = 0;
+            this._targetPath = "";
             this._weight = 1.0;
             this._ratioOffset = 0;
+            this._previousDelay = 0;
+            this._previousRatio = 0;
             this._animation = animation;
             this._target = target;
             this._scene = scene;
@@ -48169,7 +48191,18 @@ var BABYLON;
             // Blending
             var enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
-            if (enableBlending && this._blendingFactor <= 1.0 || weight !== -1.0) {
+            if (enableBlending && this._blendingFactor <= 1.0) {
+                if (!this._originalBlendValue) {
+                    var originalValue = destination[path];
+                    if (originalValue.clone) {
+                        this._originalBlendValue = originalValue.clone();
+                    }
+                    else {
+                        this._originalBlendValue = originalValue;
+                    }
+                }
+            }
+            if (weight !== -1.0) {
                 if (!this._originalValue) {
                     var originalValue = void 0;
                     if (destination.getRestPose) {
@@ -48187,31 +48220,30 @@ var BABYLON;
                 }
             }
             if (enableBlending && this._blendingFactor <= 1.0) {
-                if (this._originalValue.prototype) {
-                    if (this._originalValue.prototype.Lerp) {
-                        this._currentValue = this._originalValue.construtor.prototype.Lerp(currentValue, this._originalValue, this._blendingFactor);
+                if (this._originalBlendValue.prototype) {
+                    if (this._originalBlendValue.prototype.Lerp) {
+                        this._currentValue = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
                     }
                     else {
                         this._currentValue = currentValue;
                     }
                 }
-                else if (this._originalValue.m) {
-                    this._currentValue = BABYLON.Matrix.Lerp(this._originalValue, currentValue, this._blendingFactor);
+                else if (this._originalBlendValue.m) {
+                    this._currentValue = BABYLON.Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
                 }
                 else {
-                    this._currentValue = this._originalValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
                 this._blendingFactor += blendingSpeed;
-                destination[path] = this._currentValue;
             }
             else {
                 this._currentValue = currentValue;
-                if (weight !== -1.0) {
-                    this._scene._registerTargetForLateAnimationBinding(this);
-                }
-                else {
-                    destination[path] = this._currentValue;
-                }
+            }
+            if (weight !== -1.0) {
+                this._scene._registerTargetForLateAnimationBinding(this);
+            }
+            else {
+                destination[path] = this._currentValue;
             }
             if (this._target.markAsDirty) {
                 this._target.markAsDirty(this._animation.targetProperty);
@@ -48591,6 +48623,9 @@ var BABYLON;
                 this._localDelayOffset += delay - this._pausedDelay;
                 this._pausedDelay = null;
             }
+            if (this._weight === 0) {
+                return true;
+            }
             // Animating
             var running = false;
             var runtimeAnimations = this._runtimeAnimations;
@@ -78711,11 +78746,10 @@ var BABYLON;
             this._tmpImpostorsArray = [];
             this._tmpPositionVector = BABYLON.Vector3.Zero();
             this.BJSOIMO = typeof OIMO !== 'undefined' ? OIMO : (typeof require !== 'undefined' ? require('./Oimo') : undefined);
-            this.world = new this.BJSOIMO.World(1 / 60, 2, iterations, true);
-            this.world.worldscale(1);
+            this.world = new this.BJSOIMO.World({
+                iterations: iterations
+            });
             this.world.clear();
-            //making sure no stats are calculated
-            this.world.isNoStat = true;
         }
         OimoJSPlugin.prototype.setGravity = function (gravity) {
             this.world.gravity.copy(gravity);
@@ -78757,8 +78791,8 @@ var BABYLON;
             }
         };
         OimoJSPlugin.prototype.applyImpulse = function (impostor, force, contactPoint) {
-            var mass = impostor.physicsBody.massInfo.mass;
-            impostor.physicsBody.applyImpulse(contactPoint.scale(this.BJSOIMO.INV_SCALE), force.scale(this.BJSOIMO.INV_SCALE * mass));
+            var mass = impostor.physicsBody.mass;
+            impostor.physicsBody.applyImpulse(contactPoint.scale(this.world.invScale), force.scale(this.world.invScale * mass));
         };
         OimoJSPlugin.prototype.applyForce = function (impostor, force, contactPoint) {
             BABYLON.Tools.Warn("Oimo doesn't support applying force. Using impule instead.");
@@ -78783,8 +78817,13 @@ var BABYLON;
                     size: [],
                     type: [],
                     pos: [],
+                    posShape: [],
                     rot: [],
+                    rotShape: [],
                     move: impostor.getParam("mass") !== 0,
+                    density: impostor.getParam("mass"),
+                    friction: impostor.getParam("friction"),
+                    restitution: impostor.getParam("restitution"),
                     //Supporting older versions of Oimo
                     world: this.world
                 };
@@ -78804,18 +78843,14 @@ var BABYLON;
                     return Math.max(value, BABYLON.PhysicsEngine.Epsilon);
                 };
                 impostors.forEach(function (i) {
-                    if (!impostor.object.rotationQuaternion) {
+                    if (!i.object.rotationQuaternion) {
                         return;
                     }
                     //get the correct bounding box
                     var oldQuaternion = i.object.rotationQuaternion;
-                    var rot = new _this.BJSOIMO.Euler().setFromQuaternion({
-                        x: impostor.object.rotationQuaternion.x,
-                        y: impostor.object.rotationQuaternion.y,
-                        z: impostor.object.rotationQuaternion.z,
-                        s: impostor.object.rotationQuaternion.w
-                    });
+                    var rot = oldQuaternion.toEulerAngles();
                     var extendSize = i.getObjectExtendSize();
+                    var radToDeg = 57.295779513082320876;
                     if (i === impostor) {
                         var center = impostor.getObjectCenter();
                         impostor.object.getAbsolutePivotPoint().subtractToRef(center, _this._tmpPositionVector);
@@ -78824,25 +78859,31 @@ var BABYLON;
                         bodyConfig.pos.push(center.x);
                         bodyConfig.pos.push(center.y);
                         bodyConfig.pos.push(center.z);
+                        bodyConfig.posShape.push(0, 0, 0);
                         //tmp solution
-                        bodyConfig.rot.push(rot.x / (_this.BJSOIMO.degtorad || _this.BJSOIMO.TO_RAD));
-                        bodyConfig.rot.push(rot.y / (_this.BJSOIMO.degtorad || _this.BJSOIMO.TO_RAD));
-                        bodyConfig.rot.push(rot.z / (_this.BJSOIMO.degtorad || _this.BJSOIMO.TO_RAD));
+                        bodyConfig.rot.push(rot.x * radToDeg);
+                        bodyConfig.rot.push(rot.y * radToDeg);
+                        bodyConfig.rot.push(rot.z * radToDeg);
+                        bodyConfig.rotShape.push(0, 0, 0);
                     }
                     else {
                         var localPosition = i.object.getAbsolutePosition().subtract(impostor.object.getAbsolutePosition());
-                        bodyConfig.pos.push(localPosition.x);
-                        bodyConfig.pos.push(localPosition.y);
-                        bodyConfig.pos.push(localPosition.z);
+                        bodyConfig.posShape.push(localPosition.x);
+                        bodyConfig.posShape.push(localPosition.y);
+                        bodyConfig.posShape.push(localPosition.z);
+                        bodyConfig.pos.push(0, 0, 0);
                         //tmp solution until https://github.com/lo-th/OIMO.js/pull/37 is merged
                         bodyConfig.rot.push(0);
                         bodyConfig.rot.push(0);
                         bodyConfig.rot.push(0);
+                        bodyConfig.rotShape.push(rot.x * radToDeg);
+                        bodyConfig.rotShape.push(rot.y * radToDeg);
+                        bodyConfig.rotShape.push(rot.z * radToDeg);
                     }
                     // register mesh
                     switch (i.type) {
                         case BABYLON.PhysicsImpostor.ParticleImpostor:
-                            BABYLON.Tools.Warn("No Particle support in this.BJSOIMO.js. using SphereImpostor instead");
+                            BABYLON.Tools.Warn("No Particle support in OIMO.js. using SphereImpostor instead");
                         case BABYLON.PhysicsImpostor.SphereImpostor:
                             var radiusX = extendSize.x;
                             var radiusY = extendSize.y;
@@ -78870,15 +78911,19 @@ var BABYLON;
                             var sizeY = checkWithEpsilon_1(extendSize.y);
                             var sizeZ = checkWithEpsilon_1(extendSize.z);
                             bodyConfig.type.push('box');
+                            //if (i === impostor) {
                             bodyConfig.size.push(sizeX);
                             bodyConfig.size.push(sizeY);
                             bodyConfig.size.push(sizeZ);
+                            //} else {
+                            //    bodyConfig.size.push(0,0,0);
+                            //}
                             break;
                     }
                     //actually not needed, but hey...
                     i.object.rotationQuaternion = oldQuaternion;
                 });
-                impostor.physicsBody = new this.BJSOIMO.Body(bodyConfig).body; //this.world.add(bodyConfig);
+                impostor.physicsBody = this.world.add(bodyConfig);
             }
             else {
                 this._tmpPositionVector.copyFromFloats(0, 0, 0);
@@ -78920,7 +78965,7 @@ var BABYLON;
                     type = "jointBall";
                     break;
                 case BABYLON.PhysicsJoint.SpringJoint:
-                    BABYLON.Tools.Warn("this.BJSOIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");
+                    BABYLON.Tools.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");
                     var springData = jointData;
                     nativeJointData.min = springData.length || nativeJointData.min;
                     //Max should also be set, just make sure it is at least min
@@ -78944,7 +78989,7 @@ var BABYLON;
                     break;
             }
             nativeJointData.type = type;
-            impostorJoint.joint.physicsJoint = new this.BJSOIMO.Link(nativeJointData).joint; //this.world.add(nativeJointData);
+            impostorJoint.joint.physicsJoint = this.world.add(nativeJointData);
         };
         OimoJSPlugin.prototype.removeJoint = function (impostorJoint) {
             //Bug in Oimo prevents us from disposing a joint in the playground
@@ -78963,35 +79008,32 @@ var BABYLON;
         OimoJSPlugin.prototype.setTransformationFromPhysicsBody = function (impostor) {
             if (!impostor.physicsBody.sleeping) {
                 //TODO check that
-                if (impostor.physicsBody.shapes.next) {
+                /*if (impostor.physicsBody.shapes.next) {
                     var parentShape = this._getLastShape(impostor.physicsBody);
-                    impostor.object.position.x = parentShape.position.x * this.BJSOIMO.WORLD_SCALE;
-                    impostor.object.position.y = parentShape.position.y * this.BJSOIMO.WORLD_SCALE;
-                    impostor.object.position.z = parentShape.position.z * this.BJSOIMO.WORLD_SCALE;
-                }
-                else {
-                    impostor.object.position.copyFrom(impostor.physicsBody.getPosition());
-                }
+                    impostor.object.position.copyFrom(parentShape.position);
+                    console.log(parentShape.position);
+                } else {*/
+                impostor.object.position.copyFrom(impostor.physicsBody.getPosition());
+                //}
                 if (impostor.object.rotationQuaternion) {
                     impostor.object.rotationQuaternion.copyFrom(impostor.physicsBody.getQuaternion());
-                    impostor.object.rotationQuaternion.normalize();
                 }
             }
         };
         OimoJSPlugin.prototype.setPhysicsBodyTransformation = function (impostor, newPosition, newRotation) {
             var body = impostor.physicsBody;
-            body.position.init(newPosition.x * this.BJSOIMO.INV_SCALE, newPosition.y * this.BJSOIMO.INV_SCALE, newPosition.z * this.BJSOIMO.INV_SCALE);
-            body.orientation.init(newRotation.w, newRotation.x, newRotation.y, newRotation.z);
+            body.position.copy(newPosition);
+            body.orientation.copy(newRotation);
             body.syncShapes();
             body.awake();
         };
-        OimoJSPlugin.prototype._getLastShape = function (body) {
+        /*private _getLastShape(body: any): any {
             var lastShape = body.shapes;
             while (lastShape.next) {
                 lastShape = lastShape.next;
             }
             return lastShape;
-        };
+        }*/
         OimoJSPlugin.prototype.setLinearVelocity = function (impostor, velocity) {
             impostor.physicsBody.linearVelocity.init(velocity.x, velocity.y, velocity.z);
         };

+ 100 - 58
dist/preview release/es6.js

@@ -18787,7 +18787,7 @@ var BABYLON;
                 this.actionManager = null;
             }
             // Skeleton
-            this.skeleton = null;
+            this._skeleton = null;
             // Physics
             if (this.physicsImpostor) {
                 this.physicsImpostor.dispose();
@@ -21650,16 +21650,19 @@ var BABYLON;
             * @type {BABYLON.Observable}
             */
             this.onDisposeObservable = new BABYLON.Observable();
+            this._onDisposeObserver = null;
             /**
             * An event triggered before rendering the scene (right after animations and physics)
             * @type {BABYLON.Observable}
             */
             this.onBeforeRenderObservable = new BABYLON.Observable();
+            this._onBeforeRenderObserver = null;
             /**
             * An event triggered after rendering the scene
             * @type {BABYLON.Observable}
             */
             this.onAfterRenderObservable = new BABYLON.Observable();
+            this._onAfterRenderObserver = null;
             /**
             * An event triggered before animating the scene
             * @type {BABYLON.Observable}
@@ -21700,11 +21703,13 @@ var BABYLON;
             * @type {BABYLON.Observable}
             */
             this.onBeforeCameraRenderObservable = new BABYLON.Observable();
+            this._onBeforeCameraRenderObserver = null;
             /**
             * An event triggered after rendering a camera
             * @type {BABYLON.Observable}
             */
             this.onAfterCameraRenderObservable = new BABYLON.Observable();
+            this._onAfterCameraRenderObserver = null;
             /**
             * An event triggered when active meshes evaluation is about to start
             * @type {BABYLON.Observable}
@@ -23413,9 +23418,7 @@ var BABYLON;
                     this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent);
                 }
             }
-            if (stopCurrent) {
-                animatable.reset();
-            }
+            animatable.reset();
             return animatable;
         };
         /**
@@ -23465,6 +23468,20 @@ var BABYLON;
             }
             return null;
         };
+        /**
+         * Gets all animatables associated with a given target
+         * @param target defines the target to look animatables for
+         * @returns an array of Animatables
+         */
+        Scene.prototype.getAllAnimatablesByTarget = function (target) {
+            var result = [];
+            for (var index = 0; index < this._activeAnimatables.length; index++) {
+                if (this._activeAnimatables[index].target === target) {
+                    result.push(this._activeAnimatables[index]);
+                }
+            }
+            return result;
+        };
         Object.defineProperty(Scene.prototype, "animatables", {
             get: function () {
                 return this._activeAnimatables;
@@ -23475,12 +23492,13 @@ var BABYLON;
         /**
          * Will stop the animation of the given target
          * @param target - the target
-         * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
+         * @param animationName - the name of the animation to stop (all animations will be stopped if empty)
          * @see beginAnimation
          */
         Scene.prototype.stopAnimation = function (target, animationName) {
-            var animatable = this.getAnimatableByTarget(target);
-            if (animatable) {
+            var animatables = this.getAllAnimatablesByTarget(target);
+            for (var _i = 0, animatables_1 = animatables; _i < animatables_1.length; _i++) {
+                var animatable = animatables_1[_i];
                 animatable.stop(animationName);
             }
         };
@@ -47939,12 +47957,16 @@ var BABYLON;
          * @param scene defines the hosting scene
          */
         function RuntimeAnimation(target, animation, scene) {
+            this.currentFrame = 0;
             this._offsetsCache = {};
             this._highLimitsCache = {};
             this._stopped = false;
             this._blendingFactor = 0;
+            this._targetPath = "";
             this._weight = 1.0;
             this._ratioOffset = 0;
+            this._previousDelay = 0;
+            this._previousRatio = 0;
             this._animation = animation;
             this._target = target;
             this._scene = scene;
@@ -48156,7 +48178,7 @@ var BABYLON;
                 for (var index = 1; index < targetPropertyPath.length - 1; index++) {
                     property = property[targetPropertyPath[index]];
                 }
-                path = [targetPropertyPath.length - 1];
+                path = targetPropertyPath[targetPropertyPath.length - 1];
                 destination = property;
             }
             else {
@@ -48169,7 +48191,18 @@ var BABYLON;
             // Blending
             var enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             var blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
-            if (enableBlending && this._blendingFactor <= 1.0 || weight !== -1.0) {
+            if (enableBlending && this._blendingFactor <= 1.0) {
+                if (!this._originalBlendValue) {
+                    var originalValue = destination[path];
+                    if (originalValue.clone) {
+                        this._originalBlendValue = originalValue.clone();
+                    }
+                    else {
+                        this._originalBlendValue = originalValue;
+                    }
+                }
+            }
+            if (weight !== -1.0) {
                 if (!this._originalValue) {
                     var originalValue = void 0;
                     if (destination.getRestPose) {
@@ -48187,31 +48220,30 @@ var BABYLON;
                 }
             }
             if (enableBlending && this._blendingFactor <= 1.0) {
-                if (this._originalValue.prototype) {
-                    if (this._originalValue.prototype.Lerp) {
-                        this._currentValue = this._originalValue.construtor.prototype.Lerp(currentValue, this._originalValue, this._blendingFactor);
+                if (this._originalBlendValue.prototype) {
+                    if (this._originalBlendValue.prototype.Lerp) {
+                        this._currentValue = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
                     }
                     else {
                         this._currentValue = currentValue;
                     }
                 }
-                else if (this._originalValue.m) {
-                    this._currentValue = BABYLON.Matrix.Lerp(this._originalValue, currentValue, this._blendingFactor);
+                else if (this._originalBlendValue.m) {
+                    this._currentValue = BABYLON.Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
                 }
                 else {
-                    this._currentValue = this._originalValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
                 this._blendingFactor += blendingSpeed;
-                destination[path] = this._currentValue;
             }
             else {
                 this._currentValue = currentValue;
-                if (weight !== -1.0) {
-                    this._scene._registerTargetForLateAnimationBinding(this);
-                }
-                else {
-                    destination[path] = this._currentValue;
-                }
+            }
+            if (weight !== -1.0) {
+                this._scene._registerTargetForLateAnimationBinding(this);
+            }
+            else {
+                destination[path] = this._currentValue;
             }
             if (this._target.markAsDirty) {
                 this._target.markAsDirty(this._animation.targetProperty);
@@ -48591,6 +48623,9 @@ var BABYLON;
                 this._localDelayOffset += delay - this._pausedDelay;
                 this._pausedDelay = null;
             }
+            if (this._weight === 0) {
+                return true;
+            }
             // Animating
             var running = false;
             var runtimeAnimations = this._runtimeAnimations;
@@ -79422,11 +79457,10 @@ var BABYLON;
             this._tmpImpostorsArray = [];
             this._tmpPositionVector = BABYLON.Vector3.Zero();
             this.BJSOIMO = typeof OIMO !== 'undefined' ? OIMO : (typeof require !== 'undefined' ? require('./Oimo') : undefined);
-            this.world = new this.BJSOIMO.World(1 / 60, 2, iterations, true);
-            this.world.worldscale(1);
+            this.world = new this.BJSOIMO.World({
+                iterations: iterations
+            });
             this.world.clear();
-            //making sure no stats are calculated
-            this.world.isNoStat = true;
         }
         OimoJSPlugin.prototype.setGravity = function (gravity) {
             this.world.gravity.copy(gravity);
@@ -79468,8 +79502,8 @@ var BABYLON;
             }
         };
         OimoJSPlugin.prototype.applyImpulse = function (impostor, force, contactPoint) {
-            var mass = impostor.physicsBody.massInfo.mass;
-            impostor.physicsBody.applyImpulse(contactPoint.scale(this.BJSOIMO.INV_SCALE), force.scale(this.BJSOIMO.INV_SCALE * mass));
+            var mass = impostor.physicsBody.mass;
+            impostor.physicsBody.applyImpulse(contactPoint.scale(this.world.invScale), force.scale(this.world.invScale * mass));
         };
         OimoJSPlugin.prototype.applyForce = function (impostor, force, contactPoint) {
             BABYLON.Tools.Warn("Oimo doesn't support applying force. Using impule instead.");
@@ -79494,8 +79528,13 @@ var BABYLON;
                     size: [],
                     type: [],
                     pos: [],
+                    posShape: [],
                     rot: [],
+                    rotShape: [],
                     move: impostor.getParam("mass") !== 0,
+                    density: impostor.getParam("mass"),
+                    friction: impostor.getParam("friction"),
+                    restitution: impostor.getParam("restitution"),
                     //Supporting older versions of Oimo
                     world: this.world
                 };
@@ -79515,18 +79554,14 @@ var BABYLON;
                     return Math.max(value, BABYLON.PhysicsEngine.Epsilon);
                 };
                 impostors.forEach(function (i) {
-                    if (!impostor.object.rotationQuaternion) {
+                    if (!i.object.rotationQuaternion) {
                         return;
                     }
                     //get the correct bounding box
                     var oldQuaternion = i.object.rotationQuaternion;
-                    var rot = new _this.BJSOIMO.Euler().setFromQuaternion({
-                        x: impostor.object.rotationQuaternion.x,
-                        y: impostor.object.rotationQuaternion.y,
-                        z: impostor.object.rotationQuaternion.z,
-                        s: impostor.object.rotationQuaternion.w
-                    });
+                    var rot = oldQuaternion.toEulerAngles();
                     var extendSize = i.getObjectExtendSize();
+                    var radToDeg = 57.295779513082320876;
                     if (i === impostor) {
                         var center = impostor.getObjectCenter();
                         impostor.object.getAbsolutePivotPoint().subtractToRef(center, _this._tmpPositionVector);
@@ -79535,25 +79570,31 @@ var BABYLON;
                         bodyConfig.pos.push(center.x);
                         bodyConfig.pos.push(center.y);
                         bodyConfig.pos.push(center.z);
+                        bodyConfig.posShape.push(0, 0, 0);
                         //tmp solution
-                        bodyConfig.rot.push(rot.x / (_this.BJSOIMO.degtorad || _this.BJSOIMO.TO_RAD));
-                        bodyConfig.rot.push(rot.y / (_this.BJSOIMO.degtorad || _this.BJSOIMO.TO_RAD));
-                        bodyConfig.rot.push(rot.z / (_this.BJSOIMO.degtorad || _this.BJSOIMO.TO_RAD));
+                        bodyConfig.rot.push(rot.x * radToDeg);
+                        bodyConfig.rot.push(rot.y * radToDeg);
+                        bodyConfig.rot.push(rot.z * radToDeg);
+                        bodyConfig.rotShape.push(0, 0, 0);
                     }
                     else {
                         var localPosition = i.object.getAbsolutePosition().subtract(impostor.object.getAbsolutePosition());
-                        bodyConfig.pos.push(localPosition.x);
-                        bodyConfig.pos.push(localPosition.y);
-                        bodyConfig.pos.push(localPosition.z);
+                        bodyConfig.posShape.push(localPosition.x);
+                        bodyConfig.posShape.push(localPosition.y);
+                        bodyConfig.posShape.push(localPosition.z);
+                        bodyConfig.pos.push(0, 0, 0);
                         //tmp solution until https://github.com/lo-th/OIMO.js/pull/37 is merged
                         bodyConfig.rot.push(0);
                         bodyConfig.rot.push(0);
                         bodyConfig.rot.push(0);
+                        bodyConfig.rotShape.push(rot.x * radToDeg);
+                        bodyConfig.rotShape.push(rot.y * radToDeg);
+                        bodyConfig.rotShape.push(rot.z * radToDeg);
                     }
                     // register mesh
                     switch (i.type) {
                         case BABYLON.PhysicsImpostor.ParticleImpostor:
-                            BABYLON.Tools.Warn("No Particle support in this.BJSOIMO.js. using SphereImpostor instead");
+                            BABYLON.Tools.Warn("No Particle support in OIMO.js. using SphereImpostor instead");
                         case BABYLON.PhysicsImpostor.SphereImpostor:
                             var radiusX = extendSize.x;
                             var radiusY = extendSize.y;
@@ -79581,15 +79622,19 @@ var BABYLON;
                             var sizeY = checkWithEpsilon_1(extendSize.y);
                             var sizeZ = checkWithEpsilon_1(extendSize.z);
                             bodyConfig.type.push('box');
+                            //if (i === impostor) {
                             bodyConfig.size.push(sizeX);
                             bodyConfig.size.push(sizeY);
                             bodyConfig.size.push(sizeZ);
+                            //} else {
+                            //    bodyConfig.size.push(0,0,0);
+                            //}
                             break;
                     }
                     //actually not needed, but hey...
                     i.object.rotationQuaternion = oldQuaternion;
                 });
-                impostor.physicsBody = new this.BJSOIMO.Body(bodyConfig).body; //this.world.add(bodyConfig);
+                impostor.physicsBody = this.world.add(bodyConfig);
             }
             else {
                 this._tmpPositionVector.copyFromFloats(0, 0, 0);
@@ -79631,7 +79676,7 @@ var BABYLON;
                     type = "jointBall";
                     break;
                 case BABYLON.PhysicsJoint.SpringJoint:
-                    BABYLON.Tools.Warn("this.BJSOIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");
+                    BABYLON.Tools.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");
                     var springData = jointData;
                     nativeJointData.min = springData.length || nativeJointData.min;
                     //Max should also be set, just make sure it is at least min
@@ -79655,7 +79700,7 @@ var BABYLON;
                     break;
             }
             nativeJointData.type = type;
-            impostorJoint.joint.physicsJoint = new this.BJSOIMO.Link(nativeJointData).joint; //this.world.add(nativeJointData);
+            impostorJoint.joint.physicsJoint = this.world.add(nativeJointData);
         };
         OimoJSPlugin.prototype.removeJoint = function (impostorJoint) {
             //Bug in Oimo prevents us from disposing a joint in the playground
@@ -79674,35 +79719,32 @@ var BABYLON;
         OimoJSPlugin.prototype.setTransformationFromPhysicsBody = function (impostor) {
             if (!impostor.physicsBody.sleeping) {
                 //TODO check that
-                if (impostor.physicsBody.shapes.next) {
+                /*if (impostor.physicsBody.shapes.next) {
                     var parentShape = this._getLastShape(impostor.physicsBody);
-                    impostor.object.position.x = parentShape.position.x * this.BJSOIMO.WORLD_SCALE;
-                    impostor.object.position.y = parentShape.position.y * this.BJSOIMO.WORLD_SCALE;
-                    impostor.object.position.z = parentShape.position.z * this.BJSOIMO.WORLD_SCALE;
-                }
-                else {
-                    impostor.object.position.copyFrom(impostor.physicsBody.getPosition());
-                }
+                    impostor.object.position.copyFrom(parentShape.position);
+                    console.log(parentShape.position);
+                } else {*/
+                impostor.object.position.copyFrom(impostor.physicsBody.getPosition());
+                //}
                 if (impostor.object.rotationQuaternion) {
                     impostor.object.rotationQuaternion.copyFrom(impostor.physicsBody.getQuaternion());
-                    impostor.object.rotationQuaternion.normalize();
                 }
             }
         };
         OimoJSPlugin.prototype.setPhysicsBodyTransformation = function (impostor, newPosition, newRotation) {
             var body = impostor.physicsBody;
-            body.position.init(newPosition.x * this.BJSOIMO.INV_SCALE, newPosition.y * this.BJSOIMO.INV_SCALE, newPosition.z * this.BJSOIMO.INV_SCALE);
-            body.orientation.init(newRotation.w, newRotation.x, newRotation.y, newRotation.z);
+            body.position.copy(newPosition);
+            body.orientation.copy(newRotation);
             body.syncShapes();
             body.awake();
         };
-        OimoJSPlugin.prototype._getLastShape = function (body) {
+        /*private _getLastShape(body: any): any {
             var lastShape = body.shapes;
             while (lastShape.next) {
                 lastShape = lastShape.next;
             }
             return lastShape;
-        };
+        }*/
         OimoJSPlugin.prototype.setLinearVelocity = function (impostor, velocity) {
             impostor.physicsBody.linearVelocity.init(velocity.x, velocity.y, velocity.z);
         };

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 56 - 57
dist/preview release/viewer/babylon.viewer.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 11399 - 11578
dist/preview release/viewer/babylon.viewer.max.js


+ 4 - 0
src/Animations/babylon.animatable.ts

@@ -220,6 +220,10 @@
                 this._pausedDelay = null;
             }
 
+            if (this._weight === 0) { // We consider that an animation with a weight === 0 is "actively" paused
+                return true;
+            }
+
             // Animating
             var running = false;
             var runtimeAnimations = this._runtimeAnimations;

+ 32 - 20
src/Animations/babylon.runtimeAnimation.ts

@@ -1,11 +1,12 @@
 module BABYLON {
 
     export class RuntimeAnimation {
-        public currentFrame: number;
+        public currentFrame: number = 0;
         private _animation: Animation;
         private _target: any;
 
         private _originalValue: any;
+        private _originalBlendValue: any;
         private _offsetsCache: {[key: string]: any} = {};
         private _highLimitsCache: {[key: string]: any} = {};
         private _stopped = false;
@@ -14,7 +15,7 @@
 
         private _currentValue: any;
         private _activeTarget: any;
-        private _targetPath: string;
+        private _targetPath: string = "";
         private _weight = 1.0
 
         /**
@@ -242,7 +243,7 @@
                     property = property[targetPropertyPath[index]];
                 }
 
-                path =  [targetPropertyPath.length - 1];
+                path =  targetPropertyPath[targetPropertyPath.length - 1];
                 destination = property;
             } else {
                 path = targetPropertyPath[0];
@@ -257,14 +258,26 @@
             let enableBlending = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
             let blendingSpeed = this._target && this._target.animationPropertiesOverride ? this._target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
             
-            if (enableBlending && this._blendingFactor <= 1.0 || weight !== -1.0) {
+            if (enableBlending && this._blendingFactor <= 1.0) {
+                if (!this._originalBlendValue) {
+                    let originalValue = destination[path];
+
+                    if (originalValue.clone) {
+                        this._originalBlendValue = originalValue.clone();
+                    } else {
+                        this._originalBlendValue = originalValue;
+                    }
+                }
+            }
+
+            if (weight !== -1.0) {
                 if (!this._originalValue) {
                     let originalValue: any;
 
                     if (destination.getRestPose) { // For bones
                         originalValue = destination.getRestPose();
                     } else {
-                        originalValue = destination[path]
+                        originalValue = destination[path];
                     }
 
                     if (originalValue.clone) {
@@ -276,29 +289,28 @@
             }
 
             if (enableBlending && this._blendingFactor <= 1.0) {
-                if (this._originalValue.prototype) { // Complex value
+                if (this._originalBlendValue.prototype) { // Complex value
                     
-                    if (this._originalValue.prototype.Lerp) { // Lerp supported
-                        this._currentValue = this._originalValue.construtor.prototype.Lerp(currentValue, this._originalValue, this._blendingFactor);
+                    if (this._originalBlendValue.prototype.Lerp) { // Lerp supported
+                        this._currentValue = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
                     } else { // Blending not supported
                         this._currentValue = currentValue;
                     }
 
-                } else if (this._originalValue.m) { // Matrix
-                    this._currentValue = Matrix.Lerp(this._originalValue, currentValue, this._blendingFactor);
+                } else if (this._originalBlendValue.m) { // Matrix
+                    this._currentValue = Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
                 } else { // Direct value
-                    this._currentValue = this._originalValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
+                    this._currentValue = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
                 }
                 this._blendingFactor += blendingSpeed;
-                
-                destination[path] = this._currentValue;
             } else {
                 this._currentValue = currentValue;
-                if (weight !== -1.0) {
-                    this._scene._registerTargetForLateAnimationBinding(this);
-                } else {
-                    destination[path] = this._currentValue;
-                }
+            }
+
+            if (weight !== -1.0) {
+                this._scene._registerTargetForLateAnimationBinding(this);
+            } else {
+                destination[path] = this._currentValue;
             }
 
             if (this._target.markAsDirty) {
@@ -339,8 +351,8 @@
         }
 
         private _ratioOffset = 0;
-        private _previousDelay: number;
-        private _previousRatio: number;
+        private _previousDelay: number = 0;
+        private _previousRatio: number = 0;
 
         /**
          * Execute the current animation

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

@@ -1344,7 +1344,7 @@
             }
 
             // Skeleton
-            this.skeleton = null;
+            this._skeleton = null;
 
             // Physics
             if (this.physicsImpostor) {

+ 25 - 11
src/babylon.scene.ts

@@ -222,7 +222,7 @@
         */
         public onDisposeObservable = new Observable<Scene>();
 
-        private _onDisposeObserver: Nullable<Observer<Scene>>;
+        private _onDisposeObserver: Nullable<Observer<Scene>> = null;
         /** A function to be executed when this scene is disposed. */
         public set onDispose(callback: () => void) {
             if (this._onDisposeObserver) {
@@ -237,7 +237,7 @@
         */
         public onBeforeRenderObservable = new Observable<Scene>();
 
-        private _onBeforeRenderObserver: Nullable<Observer<Scene>>;
+        private _onBeforeRenderObserver: Nullable<Observer<Scene>> = null;
         /** A function to be executed before rendering this scene */
         public set beforeRender(callback: Nullable<() => void>) {
             if (this._onBeforeRenderObserver) {
@@ -254,7 +254,7 @@
         */
         public onAfterRenderObservable = new Observable<Scene>();
 
-        private _onAfterRenderObserver: Nullable<Observer<Scene>>;
+        private _onAfterRenderObserver: Nullable<Observer<Scene>> = null;
         /** A function to be executed after rendering this scene */
         public set afterRender(callback: Nullable<() => void>) {
             if (this._onAfterRenderObserver) {
@@ -314,7 +314,7 @@
         */
         public onBeforeCameraRenderObservable = new Observable<Camera>();
 
-        private _onBeforeCameraRenderObserver: Nullable<Observer<Camera>>;
+        private _onBeforeCameraRenderObserver: Nullable<Observer<Camera>> = null;
         public set beforeCameraRender(callback: () => void) {
             if (this._onBeforeCameraRenderObserver) {
                 this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);
@@ -329,7 +329,7 @@
         */
         public onAfterCameraRenderObservable = new Observable<Camera>();
 
-        private _onAfterCameraRenderObserver: Nullable<Observer<Camera>>;
+        private _onAfterCameraRenderObserver: Nullable<Observer<Camera>> = null;
         public set afterCameraRender(callback: () => void) {
             if (this._onAfterCameraRenderObserver) {
                 this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);
@@ -2139,9 +2139,7 @@
                 }
             }
 
-            if (stopCurrent) {
-                animatable.reset();
-            }
+            animatable.reset();
 
             return animatable;
         }
@@ -2199,6 +2197,22 @@
             return null;
         }
 
+        /**
+         * Gets all animatables associated with a given target
+         * @param target defines the target to look animatables for
+         * @returns an array of Animatables
+         */
+        public getAllAnimatablesByTarget(target: any): Array<Animatable> {
+            let result = [];
+            for (var index = 0; index < this._activeAnimatables.length; index++) {
+                if (this._activeAnimatables[index].target === target) {
+                    result.push(this._activeAnimatables[index]);
+                }
+            }
+
+            return result;
+        }        
+
         public get animatables(): Animatable[] {
             return this._activeAnimatables;
         }
@@ -2206,13 +2220,13 @@
         /**
          * Will stop the animation of the given target
          * @param target - the target
-         * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
+         * @param animationName - the name of the animation to stop (all animations will be stopped if empty)
          * @see beginAnimation
          */
         public stopAnimation(target: any, animationName?: string): void {
-            var animatable = this.getAnimatableByTarget(target);
+            var animatables = this.getAllAnimatablesByTarget(target);
 
-            if (animatable) {
+            for (var animatable of animatables) {
                 animatable.stop(animationName);
             }
         }

+ 0 - 1
src/tsconfig.json

@@ -8,7 +8,6 @@
     "isolatedModules": false,
     "sourceMap": true,
     "types": [],
-    "strict": true,
     "noImplicitAny": true,
     "noImplicitReturns": true,
     "noImplicitThis": true,