From d0cf74606f8a304d41f3b837beac14be4c562490 Mon Sep 17 00:00:00 2001 From: Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:50:54 +0900 Subject: bluebey-studio: パン中にぶるべーが中心からずれる問題を修正 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pointermoveごとに丸めていたため、細かい移動を重ねるほど中心とぶるべーの位置がずれていた。丸めはドラッグ終了時の一度だけにした。 --- public/bluebey-studio/src/main.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'public/bluebey-studio') diff --git a/public/bluebey-studio/src/main.js b/public/bluebey-studio/src/main.js index bdf5697..9178427 100644 --- a/public/bluebey-studio/src/main.js +++ b/public/bluebey-studio/src/main.js @@ -2423,8 +2423,11 @@ async function init() { 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); + // 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; view.captureInto(state.view); } else { // Shift+drag (or any touch drag on the character): slide the character, @@ -2446,8 +2449,14 @@ async function init() { view.controls.enabled = true; stage.style.cursor = ''; if (event) { try { canvas.releasePointerCapture(event.pointerId); } catch { /* ignore */ } } - if (wasPan) app.actions.syncPanel?.(); - else capturePose(); + if (wasPan) { + if (state.pose.root) { + state.pose.root = state.pose.root.map((value) => Math.round((value ?? 0) * 1000) / 1000); + } + app.actions.syncPanel?.(); + } else { + capturePose(); + } app.panel?.onRigChanged?.(); app.needsRender = true; }; -- cgit v1.3.1