aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bluebey-studio
diff options
context:
space:
mode:
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() {