瀏覽代碼

Fix bounds box display when scale is 0 in one dimension

Garrett Johnson 4 年之前
父節點
當前提交
826299d669
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/three/DebugTilesRenderer.js

+ 3 - 1
src/three/DebugTilesRenderer.js

@@ -356,9 +356,11 @@ export class DebugTilesRenderer extends TilesRenderer {
 					const cachedBoxMat = cached.boxTransform;
 
 					// Create debug bounding box
+					// In some cases the bounding box may have a scale of 0 in one dimension resulting
+					// in the NaNs in an extracted rotation so we disable matrix updates instead.
 					const boxHelperGroup = new Group();
 					boxHelperGroup.matrix.copy( cachedBoxMat );
-					boxHelperGroup.matrix.decompose( boxHelperGroup.position, boxHelperGroup.quaternion, boxHelperGroup.scale );
+					boxHelperGroup.matrixAutoUpdate = false;
 
 					const boxHelper = new Box3Helper( cachedBox );
 					boxHelper.raycast = emptyRaycast;