From 8907e88a6c66bf57f9117aa33d2c1ed4f00844e6 Mon Sep 17 00:00:00 2001 From: Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> Date: Thu, 22 Oct 2026 23:08:10 +0900 Subject: bluebey-studio: Shift+ドラッグを横=ぶるべー移動・縦=視点移動に MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 横は通常ドラッグと同じく影ごと移動し、縦だけカメラ中心を動かす。説明文も更新。 --- public/bluebey-studio/src/main.js | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) (limited to 'public/bluebey-studio/src') diff --git a/public/bluebey-studio/src/main.js b/public/bluebey-studio/src/main.js index d2de72c..05fba42 100644 --- a/public/bluebey-studio/src/main.js +++ b/public/bluebey-studio/src/main.js @@ -2341,9 +2341,9 @@ async function init() { help?.addEventListener('click', (event) => { if (event.target === help) toggleHelp(false); }); // --- the mouse on the character ---------------------------------------- - // Dragging the model moves the camera's reference point, so the scene slides - // under the cursor; holding Shift and dragging moves the character itself. - // On touch, dragging the model always moves the character (the phone + // Dragging the model slides it across the view; holding Shift and dragging + // slides it horizontally too but moves the camera's reference point up and + // down. On touch, dragging the model always moves the character (the phone // gestures). Bone posing lives in the panel, so the mouse never grabs a bone // (see `Rig` in src/rig.js). On a small screen the panel is a sheet over the // view, so a tap on the view first just dismisses the sheet. @@ -2398,33 +2398,18 @@ async function init() { const dy = event.clientY - modelDrag.y; const k = dragScale(); if (modelDrag.pan) { - // Plain drag: move the camera's reference point (the phone's two-finger - // drag). The character rides along with it, so it stays at the centre and - // orbiting still turns it in place instead of swinging it around. - // Use the step since the previous event, not the total from the press: - // pointermove fires many times per drag, so adding the total every time - // would make the pan accelerate. + // Shift+drag: horizontal moves the character with its shadow (like a + // plain drag); vertical moves the camera's reference point up/down. const stepX = event.clientX - modelDrag.lastX; const stepY = event.clientY - modelDrag.lastY; modelDrag.lastX = event.clientX; modelDrag.lastY = event.clientY; - const right = new THREE.Vector3(1, 0, 0).applyQuaternion(view.camera.quaternion); - const up = new THREE.Vector3(0, 1, 0).applyQuaternion(view.camera.quaternion); - const move = new THREE.Vector3() - .addScaledVector(right, -stepX * k) - .addScaledVector(up, stepY * k); - // Stay on the floor: a vertical drag pans forward/back, never lifts the - // character off the ground (which would detach its shadow). - move.y = 0; - view.target.add(move); - for (const controls of Object.values(view.controlsMap ?? {})) controls.target.add(move); - for (const cam of Object.values(view.cameras ?? {})) cam.position.add(move); const root = state.pose.root ?? (state.pose.root = [0, 0, 0]); - // Keep full precision while accumulating: rounding every pointermove - // drifts the character away from the camera centre (and therefore from - // the orbit axis). Round once on pointer-up instead. - root[0] = (root[0] ?? 0) + move.x; - root[2] = (root[2] ?? 0) + move.z; + root[0] = (root[0] ?? 0) + stepX * k; + const lift = -stepY * k; + view.target.y += lift; + for (const controls of Object.values(view.controlsMap ?? {})) controls.target.y += lift; + for (const cam of Object.values(view.cameras ?? {})) cam.position.y += lift; view.captureInto(state.view); } else { // Shift+drag (or any touch drag on the character): slide the character, -- cgit v1.3.1