diff options
| author | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-10-03 14:27:24 +0900 |
|---|---|---|
| committer | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-10-03 14:27:24 +0900 |
| commit | a1337fab526a9babd5c492537bd7aee4cc5e7d26 (patch) | |
| tree | 57c6df805fe9824daa51de8db06d633e9bd1de3a /public/bluebey-studio/src/rig.js | |
| parent | 7892cc6f46cdfcd6dfbbdc94d34cbf0c68f29fba (diff) | |
public/bluebey-studio: 立体の鼻ちょうちん・仰向けポーズ・ひげなどを追加
- 鼻ちょうちんをテクスチャ描画から3Dオブジェクトに変更。鼻の下に泡を
出し、master ボーンに親子付けて体の傾きに追従する
- 寝ているポーズを仰向けにし、背中が地面につく高さに調整
- ポーズを変えたら「てをふる」の動きを「とまる」に戻す
- スマホでメニュー表示中に画面外をタップするとメニューを閉じる
- 眉の長さを、左右がつながるくらいまで伸ばせるように
- 眼鏡・サングラスの「種類」を選ぶと「眼鏡をかける」を自動でオンに
- マウス操作からボーン選択を外し、ドラッグで移動・Shift+ドラッグで
向き変更にした(ボーンの操作はメニューの一覧から)
- 頭の模様: 大きさをより小さくでき、ツートンを廃止、「わけめ」に分け目
を入れ、「まえがみ(逆)」(上に凸)を追加
- ひげ(ちょびひげ・カイゼル・エプロン・ねこ)を追加
Diffstat (limited to 'public/bluebey-studio/src/rig.js')
| -rw-r--r-- | public/bluebey-studio/src/rig.js | 54 |
1 files changed, 4 insertions, 50 deletions
diff --git a/public/bluebey-studio/src/rig.js b/public/bluebey-studio/src/rig.js index 2922dfa..e06c337 100644 --- a/public/bluebey-studio/src/rig.js +++ b/public/bluebey-studio/src/rig.js @@ -51,14 +51,6 @@ export class Rig { this.controls.addEventListener('objectChange', () => { if (this.selected) this.onChange?.(this.selected); }); - - this.raycaster = new THREE.Raycaster(); - this.pointer = new THREE.Vector2(); - this.pressAt = null; - this.onPointerDown = this.handlePointerDown.bind(this); - this.onPointerUp = this.handlePointerUp.bind(this); - domElement.addEventListener('pointerdown', this.onPointerDown); - domElement.addEventListener('pointerup', this.onPointerUp); } /* ------------------------------------------------------------ selection */ @@ -76,46 +68,10 @@ export class Rig { if (!silent) this.onChange?.(this.selected); } - selectAt(event) { - const rect = this.domElement.getBoundingClientRect(); - this.pointer.set( - ((event.clientX - rect.left) / rect.width) * 2 - 1, - -((event.clientY - rect.top) / rect.height) * 2 + 1, - ); - this.raycaster.setFromCamera(this.pointer, this.controls.camera); - - const targets = this.pickTargets().filter((mesh) => mesh.visible); - const hits = this.raycaster.intersectObjects(targets, false); - if (!hits.length) return null; - - const point = hits[0].point; - let best = null; - let bestDistance = Infinity; - const world = new THREE.Vector3(); - for (const entry of this.bones) { - entry.bone.getWorldPosition(world); - const distance = world.distanceToSquared(point); - if (distance < bestDistance) { - bestDistance = distance; - best = entry.name; - } - } - if (best) this.select(best); - return best; - } - - handlePointerDown(event) { - // Remember where the press started so a drag never changes the selection. - this.pressAt = { x: event.clientX, y: event.clientY, axis: this.controls.axis }; - } - - handlePointerUp(event) { - const press = this.pressAt; - this.pressAt = null; - if (!press || press.axis) return; // pressed on the gizmo, not the model - if (Math.hypot(event.clientX - press.x, event.clientY - press.y) > 4) return; - this.selectAt(event); - } + // Clicking the model no longer reaches for a bone: the mouse is for composing + // (see the drag handling in src/main.js), and bones are picked from the panel's + // bone list, which calls `select()` directly. So there is no pointer handler on + // the canvas here at all. /* ----------------------------------------------------------------- pose */ @@ -185,8 +141,6 @@ export class Rig { } dispose() { - this.domElement.removeEventListener('pointerdown', this.onPointerDown); - this.domElement.removeEventListener('pointerup', this.onPointerUp); this.controls.detach(); this.controls.dispose(); this.helper.removeFromParent(); |
