aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bluebey-studio/src/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/bluebey-studio/src/main.js')
-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;
};