Browse Source

Stricter (and faster) checks in _activeMesh, and made sure subMeshes has atleast one.

Michael Schlotfeldt 7 years ago
parent
commit
88bacbbab6
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/babylon.scene.ts

+ 5 - 2
src/babylon.scene.ts

@@ -3107,13 +3107,16 @@
                 }
             }
 
-            if (sourceMesh.showBoundingBox || this.forceShowBoundingBoxes) {
+            if (sourceMesh.showBoundingBox === true || this.forceShowBoundingBoxes === true) {
                 let boundingInfo = sourceMesh.getBoundingInfo();
 
                 this.getBoundingBoxRenderer().renderList.push(boundingInfo.boundingBox);
             }
 
-            if (mesh && mesh.subMeshes) {
+            if (
+                mesh !== undefined && mesh !== null
+                && mesh.subMeshes !== undefined && mesh.subMeshes !== null && mesh.subMeshes.length > 0
+            ) {
                 // Submeshes Octrees
                 var len: number;
                 var subMeshes: SubMesh[];