diff options
Diffstat (limited to 'public/bluebey-studio/src/main.js')
| -rw-r--r-- | public/bluebey-studio/src/main.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/public/bluebey-studio/src/main.js b/public/bluebey-studio/src/main.js index 8d69154..b08ea11 100644 --- a/public/bluebey-studio/src/main.js +++ b/public/bluebey-studio/src/main.js @@ -2377,8 +2377,9 @@ async function init() { const dy = event.clientY - modelDrag.y; const k = dragScale(); if (modelDrag.pan) { - // Plain drag: move the camera's reference point (the same effect as the - // two-finger drag on a phone). The character stays where it is. + // 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. @@ -2391,9 +2392,15 @@ async function init() { 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]); + root[0] = round2((root[0] ?? 0) + move.x); + root[2] = round2((root[2] ?? 0) + move.z); view.captureInto(state.view); } else { // Shift+drag (or any touch drag on the character): slide the character, |
