From a721a94902a34b38925eed57893a8e86175c4d2d Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Tue, 10 Feb 2026 10:56:24 +0900 Subject: [PATCH] Update engine.ts --- packages/frontend/src/utility/room/engine.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/utility/room/engine.ts b/packages/frontend/src/utility/room/engine.ts index 85afbfbe6e..63de5d490b 100644 --- a/packages/frontend/src/utility/room/engine.ts +++ b/packages/frontend/src/utility/room/engine.ts @@ -242,6 +242,7 @@ export class RoomEngine { private intervalIds: number[] = []; private objectMeshs: Map = new Map(); private grabbing: BABYLON.AbstractMesh | null = null; + private grabbingStartOffset: BABYLON.Vector3 | null = null; private grabbingStartDistance: number | null = null; private grabbingGhost: BABYLON.AbstractMesh | null = null; private highlightedObjectId: string | null = null; @@ -459,7 +460,7 @@ export class RoomEngine { private handleGrabbing() { const dir = this.camera.getDirection(BABYLON.Axis.Z); - this.grabbingGhost.position = this.camera.position.add(dir.scale(this.grabbingStartDistance)); + this.grabbingGhost.position = this.camera.position.add(dir.scale(this.grabbingStartDistance)).add(this.grabbingStartOffset!); const stickyObjectIds = Array.from(this.def.objects.filter(o => o.sticky === this.grabbing!.metadata.objectId)).map(o => o.id); @@ -630,6 +631,7 @@ export class RoomEngine { removeStickyParentRecursively(this.grabbing); this.grabbing = null; this.grabbingStartDistance = null; + this.grabbingStartOffset = null; if (this.grabbingGhost != null) { this.grabbingGhost.dispose(false, true); this.grabbingGhost = null; @@ -638,8 +640,12 @@ export class RoomEngine { } if (this.highlightedObjectId == null) return; const highlightedObject = this.objectMeshs.get(this.highlightedObjectId)!; + for (const om of highlightedObject.getChildMeshes()) { + om.renderOutline = false; + } this.grabbing = highlightedObject; this.grabbingStartDistance = BABYLON.Vector3.Distance(this.camera.position, highlightedObject.position); + this.grabbingStartOffset = highlightedObject.position.subtract(this.camera.position.add(this.camera.getDirection(BABYLON.Axis.Z).scale(this.grabbingStartDistance))); this.grabbingGhost = highlightedObject.clone('ghost', null, false); for (const m of this.grabbingGhost!.getChildMeshes()) { m.metadata = {};