浏览代码

Fixing options init

Options init had to be changed to allow 0 values to friction etc'
Raanan Weber 10 年之前
父节点
当前提交
6b2ce5be56
共有 2 个文件被更改,包括 9 次插入6 次删除
  1. 6 3
      Babylon/Mesh/babylon.abstractMesh.js
  2. 3 3
      Babylon/Mesh/babylon.abstractMesh.ts

+ 6 - 3
Babylon/Mesh/babylon.abstractMesh.js

@@ -611,9 +611,12 @@ var BABYLON;
             if (!options) {
                 options = { mass: 0, friction: 0.2, restitution: 0.2 };
             } else {
-                options.mass = options.mass || 0;
-                options.friction = options.friction || 0.2;
-                options.restitution = options.restitution || 0.2;
+                if (!options.mass && options.mass !== 0)
+                    options.mass = 0;
+                if (!options.friction && options.friction !== 0)
+                    options.friction = 0.2;
+                if (!options.restitution && options.restitution !== 0)
+                    options.restitution = 0.2;
             }
 
             this._physicImpostor = impostor;

+ 3 - 3
Babylon/Mesh/babylon.abstractMesh.ts

@@ -603,9 +603,9 @@
             if (!options) {
                 options = { mass: 0, friction: 0.2, restitution: 0.2 };
             } else {
-                options.mass = options.mass || 0;
-                options.friction = options.friction || 0.2;
-                options.restitution = options.restitution || 0.2;
+                if (!options.mass && options.mass !== 0) options.mass = 0;
+                if (!options.friction && options.friction !== 0) options.friction = 0.2;
+                if (!options.restitution && options.restitution !== 0) options.restitution = 0.2;
             }
 
             this._physicImpostor = impostor;