aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/bluebey-studio/src/panel.js
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-23 09:24:54 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-23 09:24:54 +0900
commit09ab25113c299b8f3208a717cee9e9b8c7b07fe9 (patch)
tree3124aef01815fdf4484d5d2cc8e735b50d1d2969 /public/bluebey-studio/src/panel.js
parent2ced83398189ac47588ddde87fdbf5cae106aa4d (diff)
bluebey-studio: ドラッグの役割を入れ替え、回転中心をぶるべーに固定
Diffstat (limited to 'public/bluebey-studio/src/panel.js')
-rw-r--r--public/bluebey-studio/src/panel.js23
1 files changed, 20 insertions, 3 deletions
diff --git a/public/bluebey-studio/src/panel.js b/public/bluebey-studio/src/panel.js
index 69c8454..ae45e48 100644
--- a/public/bluebey-studio/src/panel.js
+++ b/public/bluebey-studio/src/panel.js
@@ -298,7 +298,7 @@ export function buildPanel(app, root) {
}
poseSection.add(hint('ボーンは上の一覧から選びます。スライダーは「休めの姿勢からの差」です。'
- + 'ビューポートのぶるべーは、ドラッグで移動、Shift+ドラッグで向きを変えられます。'));
+ + 'ビューポートのぶるべーは、ドラッグでカメラ移動、Shift+ドラッグでぶるべーを移動できます。どちらも回転の中心はぶるべーです。'));
// こまかい設定: the whole-body nudge and the rotation gizmo are tweaks, not the
// main way in, so they stay folded away inside the bone section.
@@ -351,8 +351,25 @@ export function buildPanel(app, root) {
app.animator.reset();
app.needsRender = true;
}
- state.pose = { bones: {}, root: [0, 0, 0] };
- applyPatch(state.pose, preset.pose ?? {});
+ // Keep where the user put ぶるべー: a pose changes the limbs and may lift the
+ // body off the ground, but it must not move the character back to the origin.
+ // `app.lastPoseRootOffset` remembers how much the previous pose added, so
+ // switching poses does not stack those lifts.
+ const previous = app.lastPoseRootOffset ?? [0, 0, 0];
+ const current = state.pose.root ?? [0, 0, 0];
+ const offset = preset.pose?.root ?? [0, 0, 0];
+ const base = [
+ (current[0] ?? 0) - (previous[0] ?? 0),
+ (current[1] ?? 0) - (previous[1] ?? 0),
+ (current[2] ?? 0) - (previous[2] ?? 0),
+ ];
+ const { root: _ignore, ...poseWithoutRoot } = preset.pose ?? {};
+ state.pose = {
+ bones: {},
+ root: [base[0] + offset[0], base[1] + offset[1], base[2] + offset[2]],
+ };
+ applyPatch(state.pose, poseWithoutRoot);
+ app.lastPoseRootOffset = [...offset];
if (!state.pose.root) state.pose.root = [0, 0, 0];
replace({}, 'pose');
sync();