aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bluebey-studio/src/main.js
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-22 14:39:22 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-22 14:39:22 +0900
commite5d1b6748a5e9d6e8e7650c657b79fc548b7393d (patch)
tree7839d399c7232c313e87d9635048af2f3e35cd7a /public/bluebey-studio/src/main.js
parentdbe32ac300ee581fb26c99eb58adfb73f630ce27 (diff)
bluebey-studio: パン後に回転がぶるべー中心になるよう修正
Diffstat (limited to 'public/bluebey-studio/src/main.js')
-rw-r--r--public/bluebey-studio/src/main.js11
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,