aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bluebey-studio/src
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-22 14:50:54 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-22 14:50:54 +0900
commitd0cf74606f8a304d41f3b837beac14be4c562490 (patch)
tree0e7f60a4d0722ef259318d0d9a45824be96c6b2f /public/bluebey-studio/src
parent5b2f8b7979d2fb0b8e0f5be175fdc8651e987bdf (diff)
bluebey-studio: パン中にぶるべーが中心からずれる問題を修正
pointermoveごとに丸めていたため、細かい移動を重ねるほど中心とぶるべーの位置がずれていた。丸めはドラッグ終了時の一度だけにした。
Diffstat (limited to 'public/bluebey-studio/src')
-rw-r--r--public/bluebey-studio/src/main.js17
1 files changed, 13 insertions, 4 deletions
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;
};