David Catuhe пре 9 година
родитељ
комит
11386e4b32

Разлика између датотеке није приказан због своје велике величине
+ 6 - 6
dist/preview release/babylon.core.js


Разлика између датотеке није приказан због своје велике величине
+ 4984 - 4968
dist/preview release/babylon.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 13 - 13
dist/preview release/babylon.js


+ 41 - 6
dist/preview release/babylon.max.js

@@ -27174,6 +27174,30 @@ var BABYLON;
         return DistanceJoint;
         return DistanceJoint;
     })(PhysicsJoint);
     })(PhysicsJoint);
     BABYLON.DistanceJoint = DistanceJoint;
     BABYLON.DistanceJoint = DistanceJoint;
+    var MotorEnabledJoint = (function (_super) {
+        __extends(MotorEnabledJoint, _super);
+        function MotorEnabledJoint(type, jointData) {
+            _super.call(this, type, jointData);
+        }
+        /**
+         * Set the motor values.
+         * Attention, this function is plugin specific. Engines won't react 100% the same.
+         * @param {number} force the force to apply
+         * @param {number} maxForce max force for this motor.
+         */
+        MotorEnabledJoint.prototype.setMotor = function (force, maxForce) {
+            this._physicsPlugin.setMotor(this, force, maxForce);
+        };
+        /**
+         * Set the motor's limits.
+         * Attention, this function is plugin specific. Engines won't react 100% the same.
+         */
+        MotorEnabledJoint.prototype.setLimit = function (upperLimit, lowerLimit) {
+            this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);
+        };
+        return MotorEnabledJoint;
+    })(PhysicsJoint);
+    BABYLON.MotorEnabledJoint = MotorEnabledJoint;
     /**
     /**
      * This class represents a single hinge physics joint
      * This class represents a single hinge physics joint
      */
      */
@@ -27199,7 +27223,7 @@ var BABYLON;
             this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);
             this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);
         };
         };
         return HingeJoint;
         return HingeJoint;
-    })(PhysicsJoint);
+    })(MotorEnabledJoint);
     BABYLON.HingeJoint = HingeJoint;
     BABYLON.HingeJoint = HingeJoint;
     /**
     /**
      * This class represents a dual hinge physics joint (same as wheel joint)
      * This class represents a dual hinge physics joint (same as wheel joint)
@@ -27232,7 +27256,7 @@ var BABYLON;
             this._physicsPlugin.setLimit(this, upperLimit, lowerLimit, motorIndex);
             this._physicsPlugin.setLimit(this, upperLimit, lowerLimit, motorIndex);
         };
         };
         return Hinge2Joint;
         return Hinge2Joint;
-    })(PhysicsJoint);
+    })(MotorEnabledJoint);
     BABYLON.Hinge2Joint = Hinge2Joint;
     BABYLON.Hinge2Joint = Hinge2Joint;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));
 
 
@@ -27285,6 +27309,8 @@ var BABYLON;
             };
             };
             //event and body object due to cannon's event-based architecture.
             //event and body object due to cannon's event-based architecture.
             this.onCollide = function (e) {
             this.onCollide = function (e) {
+                if (!_this._onPhysicsCollideCallbacks.length)
+                    return;
                 var otherImpostor = _this._physicsEngine.getImpostorWithPhysicsBody(e.body);
                 var otherImpostor = _this._physicsEngine.getImpostorWithPhysicsBody(e.body);
                 if (otherImpostor) {
                 if (otherImpostor) {
                     _this._onPhysicsCollideCallbacks.filter(function (obj) {
                     _this._onPhysicsCollideCallbacks.filter(function (obj) {
@@ -35564,8 +35590,16 @@ var BABYLON;
             nativeJointData.type = type;
             nativeJointData.type = type;
             impostorJoint.joint.physicsJoint = new OIMO.Link(nativeJointData).joint; //this.world.add(nativeJointData);
             impostorJoint.joint.physicsJoint = new OIMO.Link(nativeJointData).joint; //this.world.add(nativeJointData);
         };
         };
-        OimoJSPlugin.prototype.removeJoint = function (joint) {
-            joint.joint.physicsJoint.dispose();
+        OimoJSPlugin.prototype.removeJoint = function (impostorJoint) {
+            //Bug in Oimo prevents us from disposing a joint in the playground
+            //joint.joint.physicsJoint.dispose();
+            //So we will bruteforce it!
+            try {
+                this.world.removeJoint(impostorJoint.joint.physicsJoint);
+            }
+            catch (e) {
+                BABYLON.Tools.Warn(e);
+            }
         };
         };
         OimoJSPlugin.prototype.isSupported = function () {
         OimoJSPlugin.prototype.isSupported = function () {
             return OIMO !== undefined;
             return OIMO !== undefined;
@@ -41888,6 +41922,7 @@ var BABYLON;
             this._viewMatrix = BABYLON.Matrix.Identity();
             this._viewMatrix = BABYLON.Matrix.Identity();
             this._target = BABYLON.Vector3.Zero();
             this._target = BABYLON.Vector3.Zero();
             this._add = BABYLON.Vector3.Zero();
             this._add = BABYLON.Vector3.Zero();
+            this.invertYAxis = false;
             this.position = BABYLON.Vector3.Zero();
             this.position = BABYLON.Vector3.Zero();
             this._scene = scene;
             this._scene = scene;
             this._scene.reflectionProbes.push(this);
             this._scene.reflectionProbes.push(this);
@@ -41901,10 +41936,10 @@ var BABYLON;
                         _this._add.copyFromFloats(-1, 0, 0);
                         _this._add.copyFromFloats(-1, 0, 0);
                         break;
                         break;
                     case 2:
                     case 2:
-                        _this._add.copyFromFloats(0, -1, 0);
+                        _this._add.copyFromFloats(0, _this.invertYAxis ? 1 : -1, 0);
                         break;
                         break;
                     case 3:
                     case 3:
-                        _this._add.copyFromFloats(0, 1, 0);
+                        _this._add.copyFromFloats(0, _this.invertYAxis ? -1 : 1, 0);
                         break;
                         break;
                     case 4:
                     case 4:
                         _this._add.copyFromFloats(0, 0, 1);
                         _this._add.copyFromFloats(0, 0, 1);

Разлика између датотеке није приказан због своје велике величине
+ 13 - 13
dist/preview release/babylon.noworker.js


+ 10 - 2
src/Physics/Plugins/babylon.oimoJSPlugin.js

@@ -230,8 +230,16 @@ var BABYLON;
             nativeJointData.type = type;
             nativeJointData.type = type;
             impostorJoint.joint.physicsJoint = new OIMO.Link(nativeJointData).joint; //this.world.add(nativeJointData);
             impostorJoint.joint.physicsJoint = new OIMO.Link(nativeJointData).joint; //this.world.add(nativeJointData);
         };
         };
-        OimoJSPlugin.prototype.removeJoint = function (joint) {
-            joint.joint.physicsJoint.dispose();
+        OimoJSPlugin.prototype.removeJoint = function (impostorJoint) {
+            //Bug in Oimo prevents us from disposing a joint in the playground
+            //joint.joint.physicsJoint.dispose();
+            //So we will bruteforce it!
+            try {
+                this.world.removeJoint(impostorJoint.joint.physicsJoint);
+            }
+            catch (e) {
+                BABYLON.Tools.Warn(e);
+            }
         };
         };
         OimoJSPlugin.prototype.isSupported = function () {
         OimoJSPlugin.prototype.isSupported = function () {
             return OIMO !== undefined;
             return OIMO !== undefined;

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

@@ -47,6 +47,8 @@ var BABYLON;
             };
             };
             //event and body object due to cannon's event-based architecture.
             //event and body object due to cannon's event-based architecture.
             this.onCollide = function (e) {
             this.onCollide = function (e) {
+                if (!_this._onPhysicsCollideCallbacks.length)
+                    return;
                 var otherImpostor = _this._physicsEngine.getImpostorWithPhysicsBody(e.body);
                 var otherImpostor = _this._physicsEngine.getImpostorWithPhysicsBody(e.body);
                 if (otherImpostor) {
                 if (otherImpostor) {
                     _this._onPhysicsCollideCallbacks.filter(function (obj) {
                     _this._onPhysicsCollideCallbacks.filter(function (obj) {

+ 26 - 2
src/Physics/babylon.physicsJoint.js

@@ -79,6 +79,30 @@ var BABYLON;
         return DistanceJoint;
         return DistanceJoint;
     })(PhysicsJoint);
     })(PhysicsJoint);
     BABYLON.DistanceJoint = DistanceJoint;
     BABYLON.DistanceJoint = DistanceJoint;
+    var MotorEnabledJoint = (function (_super) {
+        __extends(MotorEnabledJoint, _super);
+        function MotorEnabledJoint(type, jointData) {
+            _super.call(this, type, jointData);
+        }
+        /**
+         * Set the motor values.
+         * Attention, this function is plugin specific. Engines won't react 100% the same.
+         * @param {number} force the force to apply
+         * @param {number} maxForce max force for this motor.
+         */
+        MotorEnabledJoint.prototype.setMotor = function (force, maxForce) {
+            this._physicsPlugin.setMotor(this, force, maxForce);
+        };
+        /**
+         * Set the motor's limits.
+         * Attention, this function is plugin specific. Engines won't react 100% the same.
+         */
+        MotorEnabledJoint.prototype.setLimit = function (upperLimit, lowerLimit) {
+            this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);
+        };
+        return MotorEnabledJoint;
+    })(PhysicsJoint);
+    BABYLON.MotorEnabledJoint = MotorEnabledJoint;
     /**
     /**
      * This class represents a single hinge physics joint
      * This class represents a single hinge physics joint
      */
      */
@@ -104,7 +128,7 @@ var BABYLON;
             this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);
             this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);
         };
         };
         return HingeJoint;
         return HingeJoint;
-    })(PhysicsJoint);
+    })(MotorEnabledJoint);
     BABYLON.HingeJoint = HingeJoint;
     BABYLON.HingeJoint = HingeJoint;
     /**
     /**
      * This class represents a dual hinge physics joint (same as wheel joint)
      * This class represents a dual hinge physics joint (same as wheel joint)
@@ -137,6 +161,6 @@ var BABYLON;
             this._physicsPlugin.setLimit(this, upperLimit, lowerLimit, motorIndex);
             this._physicsPlugin.setLimit(this, upperLimit, lowerLimit, motorIndex);
         };
         };
         return Hinge2Joint;
         return Hinge2Joint;
-    })(PhysicsJoint);
+    })(MotorEnabledJoint);
     BABYLON.Hinge2Joint = Hinge2Joint;
     BABYLON.Hinge2Joint = Hinge2Joint;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 3 - 2
src/Probes/babylon.reflectionProbe.js

@@ -8,6 +8,7 @@ var BABYLON;
             this._viewMatrix = BABYLON.Matrix.Identity();
             this._viewMatrix = BABYLON.Matrix.Identity();
             this._target = BABYLON.Vector3.Zero();
             this._target = BABYLON.Vector3.Zero();
             this._add = BABYLON.Vector3.Zero();
             this._add = BABYLON.Vector3.Zero();
+            this.invertYAxis = false;
             this.position = BABYLON.Vector3.Zero();
             this.position = BABYLON.Vector3.Zero();
             this._scene = scene;
             this._scene = scene;
             this._scene.reflectionProbes.push(this);
             this._scene.reflectionProbes.push(this);
@@ -21,10 +22,10 @@ var BABYLON;
                         _this._add.copyFromFloats(-1, 0, 0);
                         _this._add.copyFromFloats(-1, 0, 0);
                         break;
                         break;
                     case 2:
                     case 2:
-                        _this._add.copyFromFloats(0, -1, 0);
+                        _this._add.copyFromFloats(0, _this.invertYAxis ? 1 : -1, 0);
                         break;
                         break;
                     case 3:
                     case 3:
-                        _this._add.copyFromFloats(0, 1, 0);
+                        _this._add.copyFromFloats(0, _this.invertYAxis ? -1 : 1, 0);
                         break;
                         break;
                     case 4:
                     case 4:
                         _this._add.copyFromFloats(0, 0, 1);
                         _this._add.copyFromFloats(0, 0, 1);

+ 3 - 2
src/Probes/babylon.reflectionProbe.ts

@@ -8,6 +8,7 @@
         private _add = Vector3.Zero();
         private _add = Vector3.Zero();
         private _attachedMesh: AbstractMesh;
         private _attachedMesh: AbstractMesh;
 
 
+        public invertYAxis = false;
         public position = Vector3.Zero();
         public position = Vector3.Zero();
           
           
         constructor(public name: string, size: number, scene: Scene, generateMipMaps = true) {
         constructor(public name: string, size: number, scene: Scene, generateMipMaps = true) {
@@ -26,10 +27,10 @@
                         this._add.copyFromFloats(-1, 0, 0);
                         this._add.copyFromFloats(-1, 0, 0);
                         break;
                         break;
                     case 2:
                     case 2:
-                        this._add.copyFromFloats(0, -1, 0);
+                        this._add.copyFromFloats(0, this.invertYAxis ? 1 : -1, 0);
                         break;
                         break;
                     case 3:
                     case 3:
-                        this._add.copyFromFloats(0, 1, 0);
+                        this._add.copyFromFloats(0, this.invertYAxis ? -1 : 1, 0);
                         break;
                         break;
                     case 4:
                     case 4:
                         this._add.copyFromFloats(0, 0, 1);
                         this._add.copyFromFloats(0, 0, 1);