From 4cf9c37ecd568dab470b5714bff4ff9f860a5377 Mon Sep 17 00:00:00 2001 From: Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> Date: Sat, 3 Oct 2026 15:21:33 +0900 Subject: public/bluebey-studio: ドラッグで体が回らないようにする MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 非表示の回転ギズモが、three では隠れていてもポインタを取ってしまうため、ぶるべーをつかんで動かすと master ボーンが回り、体の向きが変わっていた。ギズモを表示していないときは TransformControls を無効にした(表示中は今までどおり操作できる)。 --- public/bluebey-studio/src/rig.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'public/bluebey-studio/src/rig.js') diff --git a/public/bluebey-studio/src/rig.js b/public/bluebey-studio/src/rig.js index e06c337..1afe669 100644 --- a/public/bluebey-studio/src/rig.js +++ b/public/bluebey-studio/src/rig.js @@ -36,6 +36,12 @@ export class Rig { this.controls.setMode('rotate'); this.controls.setSpace('local'); this.controls.setSize(0.8); + // A *hidden* TransformControls still grabs the pointer in three: its picker + // stays raycastable even when the helper is not drawn, so grabbing the body + // (the rings sit on the `master` bone, right where you grab) silently turned + // the character. Keep the controls disabled until the gizmo is actually + // shown, so the mouse can only move the character (see setGizmoVisible). + this.controls.enabled = false; this.helper = this.controls.getHelper(); this.helper.visible = false; // Whether the user wants the gizmo at all. It starts OFF: the model is the @@ -65,6 +71,8 @@ export class Rig { this.controls.detach(); this.helper.visible = false; } + // Only an actually-shown gizmo may take the pointer (see the constructor). + this.controls.enabled = this.helper.visible; if (!silent) this.onChange?.(this.selected); } @@ -138,6 +146,8 @@ export class Rig { setGizmoVisible(visible) { this.gizmoWanted = visible !== false; this.helper.visible = this.gizmoWanted && this.selected != null; + // A hidden gizmo must not grab the pointer (see the constructor). + this.controls.enabled = this.helper.visible; } dispose() { -- cgit v1.3.1