Browse Source

Fix getHierarchyBoundingVectors computation

David Catuhe 6 years ago
parent
commit
b77b2e6e74
1 changed files with 8 additions and 8 deletions
  1. 8 8
      src/node.ts

+ 8 - 8
src/node.ts

@@ -781,12 +781,12 @@ export class Node implements IBehaviorAware<Node> {
             }
         }
     }
-        /**
-     * Return the minimum and maximum world vectors of the entire hierarchy under current node
-     * @param includeDescendants Include bounding info from descendants as well (true by default)
-     * @param predicate defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors
-     * @returns the new bounding vectors
-     */
+    /**
+ * Return the minimum and maximum world vectors of the entire hierarchy under current node
+ * @param includeDescendants Include bounding info from descendants as well (true by default)
+ * @param predicate defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors
+ * @returns the new bounding vectors
+ */
     public getHierarchyBoundingVectors(includeDescendants = true, predicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null): { min: Vector3, max: Vector3 } {
         // Ensures that all world matrix will be recomputed.
         this.getScene().incrementRenderId();
@@ -800,8 +800,8 @@ export class Node implements IBehaviorAware<Node> {
         if (thisAbstractMesh.getBoundingInfo && thisAbstractMesh.subMeshes) {
             // If this is an abstract mesh get its bounding info
             let boundingInfo = thisAbstractMesh.getBoundingInfo();
-            min = boundingInfo.boundingBox.minimumWorld;
-            max = boundingInfo.boundingBox.maximumWorld;
+            min = boundingInfo.boundingBox.minimumWorld.clone();
+            max = boundingInfo.boundingBox.maximumWorld.clone();
         } else {
             min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
             max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);