roamwright 0.61.7 → 0.61.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -188,7 +188,8 @@ function createFigureArms({ gestureOf, seat, blade, flier = () => false, dropInt
188
188
  }
189
189
  w.foreL = foreL;
190
190
  w.foreR = foreR;
191
- if (seated > FELT) seatedArms(a, w, a.cur[TRUNK]);
191
+ // an act has the arms it names even in the saddle or on a seat: the seat keeps only the rest
192
+ if (seated > FELT) seatedArms(a, w, a.cur[TRUNK], act ? 1 - act[HAS_LEFT] : 1, act ? 1 - act[HAS_RIGHT] : 1);
192
193
  const flatL = (held && held.r && !held.stow && (held.both || held.left)) || (held && held.flat),
193
194
  flatR = held && held.r && !held.stow && !held.left;
194
195
  let turnL = seated * onTable(a, true) * (0.42 + a.seed * 0.2) + (gesture ? gesture[LY] : 0) + recTurnL,
@@ -58,7 +58,7 @@ const FLAT = () => 0,
58
58
  * metres, table: the height of a table before it, if any }) is in the place being shown; every seat is, by default.
59
59
  * @returns {object} seatTarget(a, w, t) and kneelTarget(a, w, footGround): the pose's targets for this frame on a seat (a
60
60
  * stool, a horse: `a.mount`) or on one knee, with `a.joints` solved; groundUnderKnee(a, size): the ground under a kneeling
61
- * figure's forward foot (and into `a.y` under its knee); seatedArms(a, w, lean); onTable(a, left); kneeOf(a, left);
61
+ * figure's forward foot (and into `a.y` under its knee); seatedArms(a, w, lean, freeL, freeR) (freeL, freeR: each arm's share left to the seat, 1 by default; an act takes the rest); onTable(a, left); kneeOf(a, left);
62
62
  * freeKnees(a, thighL, thighR); conformGroundPosture(a, w, target) and groundConformState(): a
63
63
  * crawler's or a lying body's fit to the slope under it.
64
64
  */
@@ -186,15 +186,16 @@ function createFigureSeat({ ground = FLAT, seatHere = ANY_SEAT } = {}) {
186
186
  CLOSEST = 0.14; // and one nearer the shoulder than this is taken as this far
187
187
  const armIK = (forward, up) => solveTwoBone(reach, UPPER_ARM, FOREARM, forward, up, CLOSEST, (UPPER_ARM + FOREARM) * FULL_REACH);
188
188
  // A seated figure's arms reach for where its hands rest (seatTarget), as far as it is seated.
189
- function seatedArms(a, w, lean) {
189
+ function seatedArms(a, w, lean, freeL = 1, freeR = 1) {
190
190
  const joints = a.joints,
191
- seated = w.seated;
191
+ seatedL = w.seated * freeL,
192
+ seatedR = w.seated * freeR;
192
193
  let solved = armIK(joints[HAND_L_FWD], joints[HAND_L_UP]);
193
- w.armL = lerp(w.armL, -solved[0] - lean, seated);
194
- w.foreL = lerp(w.foreL, -solved[1], seated);
194
+ w.armL = lerp(w.armL, -solved[0] - lean, seatedL);
195
+ w.foreL = lerp(w.foreL, -solved[1], seatedL);
195
196
  solved = armIK(joints[HAND_R_FWD], joints[HAND_R_UP]);
196
- w.armR = lerp(w.armR, -solved[0] - lean, seated);
197
- w.foreR = lerp(w.foreR, -solved[1], seated);
197
+ w.armR = lerp(w.armR, -solved[0] - lean, seatedR);
198
+ w.foreR = lerp(w.foreR, -solved[1], seatedR);
198
199
  }
199
200
  // How far each seated forearm lies on the table (0 to 1).
200
201
  const onTable = (a, left) => a.joints[left ? TABLE_L : TABLE_R];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roamwright",
3
- "version": "0.61.7",
3
+ "version": "0.61.8",
4
4
  "description": "A procedural worldbuilding engine built on top of Three.js. Generate landscapes with rivers and changing weather, animate crowds, and explore on foot or in flight.",
5
5
  "keywords": [
6
6
  "threejs",