From c5c1e2f6c97ff2d85da43bc312490dc21e16a790 Mon Sep 17 00:00:00 2001 From: ChenX Date: Fri, 21 Oct 2022 09:42:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=E7=BB=98=E5=88=B6=E9=97=A8?= =?UTF-8?q?=E6=9D=BF=E6=97=B6=E9=93=B0=E9=93=BE=E6=97=A0=E6=B3=95=E5=92=8C?= =?UTF-8?q?=E9=97=A8=E6=9D=BF=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DrawBoard/DrawDoorDrawer/DrawDoorTool.ts | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Add-on/DrawBoard/DrawDoorDrawer/DrawDoorTool.ts b/src/Add-on/DrawBoard/DrawDoorDrawer/DrawDoorTool.ts index 14d67e5ca..cb2858f16 100644 --- a/src/Add-on/DrawBoard/DrawDoorDrawer/DrawDoorTool.ts +++ b/src/Add-on/DrawBoard/DrawDoorDrawer/DrawDoorTool.ts @@ -634,7 +634,7 @@ export class DrawDoorTool { if (!IsHinge(ironware)) continue; - if (!this.IsIntersects(realityBox, otherEnt.Entitys)) continue; + if (!this.IsIntersects(realityBox, [otherEnt])) continue; if (IsDoor(otherEnt)) { @@ -941,18 +941,25 @@ export class DrawDoorTool } } - private IsIntersects(enBox: Box3, checkEnts: Entity[]): boolean + private IsIntersects(enBox: Box3, checkEnts: Entity[], parentOCS?: Matrix4): boolean { for (let checkEnt of checkEnts) { if (checkEnt instanceof HardwareCompositeEntity) - if (this.IsIntersects(enBox, checkEnt.Entitys)) - return true; - else continue; + { + let ocs = checkEnt.OCSNoClone; + if (parentOCS) ocs = new Matrix4().multiplyMatrices(parentOCS, ocs); - let box = checkEnt.BoundingBox as Box3Ext; - if (box.intersectsBox(enBox, 10)) - return true; + if (this.IsIntersects(enBox, checkEnt.Entitys, ocs)) + return true; + } + else + { + let box = checkEnt.BoundingBox as Box3Ext; + if (parentOCS) box.applyMatrix4(parentOCS); + if (box.intersectsBox(enBox, 10)) + return true; + } } return false; }