Browse Source

Merge pull request #5218 from barroij/setBoundingBiasPerfIssue

Geometry.BoundingBias setter per issue
David Catuhe 7 năm trước cách đây
mục cha
commit
a0ac9b9002
1 tập tin đã thay đổi với 8 bổ sung4 xóa
  1. 8 4
      src/Mesh/babylon.geometry.ts

+ 8 - 4
src/Mesh/babylon.geometry.ts

@@ -61,11 +61,15 @@
          *  Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y
          */
         public set boundingBias(value: Vector2) {
-            if (this._boundingBias && this._boundingBias.equals(value)) {
-                return;
+            if (this._boundingBias) {
+                if (this._boundingBias.equals(value)) {
+                    return;
+                }
+                this._boundingBias.copyFrom(value);
+            }
+            else {
+                this._boundingBias = value.clone();
             }
-
-            this._boundingBias = value.clone();
 
             this._updateBoundingInfo(true, null);
         }