aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bluebey-studio
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-03 15:21:33 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-03 15:21:33 +0900
commit4cf9c37ecd568dab470b5714bff4ff9f860a5377 (patch)
tree683d793c52869a130c13a9a5fcfc83ad532d1fa0 /public/bluebey-studio
parent20e722e5ab241d0a2153a3fdcff8fc8fddf1361e (diff)
public/bluebey-studio: ドラッグで体が回らないようにする
非表示の回転ギズモが、three では隠れていてもポインタを取ってしまうため、ぶるべーをつかんで動かすと master ボーンが回り、体の向きが変わっていた。ギズモを表示していないときは TransformControls を無効にした(表示中は今までどおり操作できる)。
Diffstat (limited to 'public/bluebey-studio')
-rw-r--r--public/bluebey-studio/src/rig.js10
1 files changed, 10 insertions, 0 deletions
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() {