tosijs-3d 0.12.6 → 0.13.0

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/Migration.md +18 -0
  3. package/README.md +8 -2
  4. package/changelog/v0.13.0.md +48 -0
  5. package/dist/aim-ik.d.ts +13 -0
  6. package/dist/aim-ik.d.ts.map +1 -0
  7. package/dist/aim-ik.js +111 -0
  8. package/dist/aim-ik.js.map +1 -0
  9. package/dist/b3d-biped.d.ts +5 -0
  10. package/dist/b3d-biped.d.ts.map +1 -1
  11. package/dist/b3d-biped.js +59 -1
  12. package/dist/b3d-biped.js.map +1 -1
  13. package/dist/b3d-cloud-deck.d.ts +7 -0
  14. package/dist/b3d-cloud-deck.d.ts.map +1 -1
  15. package/dist/b3d-cloud-deck.js +10 -2
  16. package/dist/b3d-cloud-deck.js.map +1 -1
  17. package/dist/b3d-crowd.d.ts +31 -0
  18. package/dist/b3d-crowd.d.ts.map +1 -1
  19. package/dist/b3d-crowd.js +191 -3
  20. package/dist/b3d-crowd.js.map +1 -1
  21. package/dist/b3d-hud.d.ts.map +1 -1
  22. package/dist/b3d-hud.js +3 -1
  23. package/dist/b3d-hud.js.map +1 -1
  24. package/dist/b3d-launcher.d.ts.map +1 -1
  25. package/dist/b3d-launcher.js +5 -2
  26. package/dist/b3d-launcher.js.map +1 -1
  27. package/dist/b3d-panel.d.ts +3 -0
  28. package/dist/b3d-panel.d.ts.map +1 -1
  29. package/dist/b3d-panel.js +3 -0
  30. package/dist/b3d-panel.js.map +1 -1
  31. package/dist/b3d-skybox.d.ts +3 -0
  32. package/dist/b3d-skybox.d.ts.map +1 -1
  33. package/dist/b3d-skybox.js +40 -17
  34. package/dist/b3d-skybox.js.map +1 -1
  35. package/dist/b3d-sound.d.ts.map +1 -1
  36. package/dist/b3d-sound.js +18 -5
  37. package/dist/b3d-sound.js.map +1 -1
  38. package/dist/b3d-utils.d.ts +1 -0
  39. package/dist/b3d-utils.d.ts.map +1 -1
  40. package/dist/b3d-utils.js +79 -0
  41. package/dist/b3d-utils.js.map +1 -1
  42. package/dist/bar-menu.d.ts +1 -1
  43. package/dist/bar-menu.d.ts.map +1 -1
  44. package/dist/bar-menu.js +187 -136
  45. package/dist/bar-menu.js.map +1 -1
  46. package/dist/body-export.d.ts.map +1 -1
  47. package/dist/body-export.js +4 -1
  48. package/dist/body-export.js.map +1 -1
  49. package/dist/character-builder.d.ts.map +1 -1
  50. package/dist/character-builder.js +50 -2
  51. package/dist/character-builder.js.map +1 -1
  52. package/dist/city-drive.js +3 -3
  53. package/dist/cloth-bake.js +2 -2
  54. package/dist/cross-country.js +3 -3
  55. package/dist/effect-audio.d.ts +6 -0
  56. package/dist/effect-audio.d.ts.map +1 -1
  57. package/dist/effect-audio.js +23 -1
  58. package/dist/effect-audio.js.map +1 -1
  59. package/dist/frame-panel.d.ts +6 -0
  60. package/dist/frame-panel.d.ts.map +1 -1
  61. package/dist/frame-panel.js +13 -0
  62. package/dist/frame-panel.js.map +1 -1
  63. package/dist/garment-proxy.js +1 -1
  64. package/dist/index.d.ts +1 -0
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +1 -0
  67. package/dist/index.js.map +1 -1
  68. package/dist/moon-light.d.ts +16 -0
  69. package/dist/moon-light.d.ts.map +1 -0
  70. package/dist/moon-light.js +33 -0
  71. package/dist/moon-light.js.map +1 -0
  72. package/dist/outline-field.d.ts.map +1 -1
  73. package/dist/outline-field.js +31 -5
  74. package/dist/outline-field.js.map +1 -1
  75. package/dist/panel-layer.d.ts +9 -0
  76. package/dist/panel-layer.d.ts.map +1 -1
  77. package/dist/panel-layer.js +4 -2
  78. package/dist/panel-layer.js.map +1 -1
  79. package/dist/playground.d.ts.map +1 -1
  80. package/dist/playground.js +6 -1
  81. package/dist/playground.js.map +1 -1
  82. package/dist/popup-surface.d.ts.map +1 -1
  83. package/dist/popup-surface.js +34 -3
  84. package/dist/popup-surface.js.map +1 -1
  85. package/dist/rigged-body-glb.d.ts +15 -6
  86. package/dist/rigged-body-glb.d.ts.map +1 -1
  87. package/dist/rigged-body-glb.js +19 -8
  88. package/dist/rigged-body-glb.js.map +1 -1
  89. package/dist/scene-schemas.d.ts.map +1 -1
  90. package/dist/scene-schemas.js +4 -0
  91. package/dist/scene-schemas.js.map +1 -1
  92. package/dist/shadow-decal.d.ts.map +1 -1
  93. package/dist/shadow-decal.js +3 -0
  94. package/dist/shadow-decal.js.map +1 -1
  95. package/dist/shared-mute.d.ts +8 -0
  96. package/dist/shared-mute.d.ts.map +1 -0
  97. package/dist/shared-mute.js +30 -0
  98. package/dist/shared-mute.js.map +1 -0
  99. package/dist/system-bar.d.ts.map +1 -1
  100. package/dist/system-bar.js +8 -2
  101. package/dist/system-bar.js.map +1 -1
  102. package/dist/tosi-b3d.d.ts +7 -0
  103. package/dist/tosi-b3d.d.ts.map +1 -1
  104. package/dist/tosi-b3d.js +159 -116
  105. package/dist/tosi-b3d.js.map +1 -1
  106. package/dist/touch-orbit.d.ts +18 -3
  107. package/dist/touch-orbit.d.ts.map +1 -1
  108. package/dist/touch-orbit.js +54 -6
  109. package/dist/touch-orbit.js.map +1 -1
  110. package/package.json +2 -2
  111. package/static/attributes.json +9 -1
  112. package/static/attributes.txt +3 -1
package/CHANGELOG.md CHANGED
@@ -12,9 +12,9 @@ Upgrading across a minor? Start with [Migration](/Migration/).
12
12
 
13
13
  ## Unreleased
14
14
 
15
- ## 0.12.6
15
+ ## 0.13.0
16
16
 
17
- The latest release. BVH clips kept and carried in character files; MakeHuman's body exports dressed, with hair, skin and eyes; tailored garments fit any body; feet stay planted under retargeting; marker rigs place pelvis, neck and knees as the mannequins do. See [0.12.6](/v0.12.6/).
17
+ The latest release. Biped gunplay aims where you look, crowds move figure by figure, system-bar menus cascade flat and in VR, and headset panels, presses and the chase camera behave. Garment exports bake their look only when given the baker. See [0.13.0](/v0.13.0/).
18
18
 
19
19
  ## Every version
20
20
 
package/Migration.md CHANGED
@@ -9,6 +9,24 @@ This file ships **inside the package**, because a migration table you can only
9
9
  read on GitHub does not exist for someone who has already installed the thing
10
10
  and is staring at an error.
11
11
 
12
+ ## 0.12.x → 0.13.0
13
+
14
+ The peer ranges are unchanged. Four things change under you:
15
+
16
+ 1. **`riggedBodyGlb` no longer recolours garment pictures by default.** Its
17
+ `bake` option is now the baker itself: pass `bake: bakeClothLook` (from
18
+ `tosijs-3d/cloth-bake`) to keep the baked look. Without it the pictures
19
+ are written as they are, and it warns once. `bake: false` still means no
20
+ bake; `bake: true` no longer means anything. `exportBody` passes the baker
21
+ for you.
22
+ 2. **The settings panel's Slow motion button is gone.** Set `timeScale` on
23
+ the `<tosi-b3d>` from your own control if you want one.
24
+ 3. **`barMenu` submenus cascade** beside the list, all on one surface,
25
+ instead of replacing it with a way back. A press opens one; a press on its
26
+ row again closes it.
27
+ 4. **`viewMenu` leaves the system bar during a headset session**, since in VR
28
+ the camera is your head. It comes back when the session ends.
29
+
12
30
  ## 0.11.x → 0.12.0
13
31
 
14
32
  The peer ranges are unchanged. Four things change under you:
package/README.md CHANGED
@@ -130,7 +130,10 @@ tubes bored through them, arches, caverns.
130
130
 
131
131
  **Biped control** — a [character controller](https://3d.tosijs.net/b3d-biped/)
132
132
  with an animation state machine and follow/XR cameras, from a GLB: walk, run
133
- and sprint, jump, swim, climb ledges.
133
+ and sprint, jump, swim, climb ledges, and hold a gun that
134
+ [points where you aim](https://3d.tosijs.net/aim-ik/), crouched or standing.
135
+ [Crowds](https://3d.tosijs.net/b3d-crowd/) of thousands are drawn on the GPU,
136
+ and each figure can be moved, turned and re-clipped.
134
137
 
135
138
  **Any character on one animation library** — [retargeting](https://3d.tosijs.net/retarget/)
136
139
  plays the Universal Animation Library's clips on a Mixamo, Kenney or
@@ -167,6 +170,9 @@ renders as a DOM overlay, as a texture on a surface in the scene, and as a
167
170
  floating panel in a headset, from the same declaration. Includes a
168
171
  [flowing box model](https://3d.tosijs.net/box/), [menus and panels](https://3d.tosijs.net/surface/),
169
172
  a data table, and an on-screen keyboard — because a headset has nowhere to type.
173
+ A [system bar](https://3d.tosijs.net/system-bar/) of buttons and
174
+ [cascading menus](https://3d.tosijs.net/bar-menu/) sits in the corner flat and
175
+ up ahead in VR.
170
176
 
171
177
  **SVG textures** — [draw with SVG](https://3d.tosijs.net/svg-texture/), use it as
172
178
  a live texture. Designer artwork becomes a HUD, a gauge, or a control surface
@@ -196,7 +202,7 @@ or a server imports them without Babylon.
196
202
 
197
203
  **Pure models, actually tested** — the flight model, ballistics, guidance, biome
198
204
  classification, layout and text editing are engine-free and unit-tested (about
199
- 3,000 tests, run in seconds with no GPU). If it can be a function of its inputs,
205
+ 3,900 tests, run in about a minute with no GPU). If it can be a function of its inputs,
200
206
  it is.
201
207
 
202
208
  ## Development
@@ -0,0 +1,48 @@
1
+ # 0.13.0
2
+
3
+ <!--{ "parent": "CHANGELOG", "order": 9987000 }-->
4
+
5
+ Biped gunplay that aims where you look, crowds you can move figure by figure, cascading system-bar menus that work flat and in a headset (the character builder's Animation menu among them), and a round of headset fixes: panels that keep their place under the bar, presses from either hand, a chase camera that keeps its seat. Garment exports bake their cloth look only when given the baker.
6
+
7
+ Size: barrel (min, packages external) 1707.6 KB raw / 594.0 KB gz, up 9.2 KB / 3.0 KB gz (+0.5%) on 0.12.6.
8
+
9
+ ### ⚠️ Breaking
10
+
11
+ - `riggedBodyGlb` bakes a garment's cloth look only when given the baker: pass `bake: bakeClothLook` (from `tosijs-3d/cloth-bake`). Without it the pictures are written as they are, and a bundle that imports `tosijs-3d/rigged-body-glb` alone no longer carries an image decoder (about 11 KiB gzip less; the barrel still exports both). It warns once when a garment has a look and no baker. `exportBody` passes it. `bake: false` still means no bake.
12
+
13
+ See [Migration](/Migration/) for the other changes that need attention (Slow motion removed, cascading `barMenu` submenus, `viewMenu` in a headset).
14
+
15
+ ### Added
16
+
17
+ - `<tosi-b3d-crowd>`: `setFigure(i, { x, y, z, yaw, clip, speed })` moves, turns or re-clips a figure; changes are uploaded once per frame however many figures moved. `clipNames` lists the clips. The doc page has a demo of walkers crossing a field.
18
+ - `aimSpine(chain, held, target)` turns a spine after the clips have posed it so a held item points along an aim.
19
+ - `<tosi-b3d-cloud-deck sky-clock="off">`: the deck drifts in world time, not the sky's, so a fast day passes under clouds that move at their own pace. City Drive and Cross Country use it.
20
+ - `<tosi-b3d-panel bar-button="off">`: a system panel with no button of its own on the bar, for one something else opens (`el.show()` from a menu entry).
21
+
22
+ ### Changed
23
+
24
+ - `<tosi-b3d-biped>` holding a weapon in `gunplay` points it along its aim: the spine is turned after the animations. Crouched, the gun used to point about 45° low, and standing 11° low.
25
+ - `viewMenu` leaves the system bar during a headset session; in VR the camera is your head.
26
+ - A trackpad pinch on an orbit camera zooms three times as far (`PINCH_GAIN`), and pinching works in Safari, which sends gesture events rather than a ctrl-wheel.
27
+ - The character builder has an **Animation** menu on the system bar (play/pause and the clip); its **Playback controls** entry opens a small panel for scrubbing and speed. The page is titled **Character Builder**. While rigging, Play goes to the perspective view and Pause back to the face view last held.
28
+ - `barMenu` submenus open beside the list (cascading, all on one surface) instead of replacing it with a way back. A submenu opens on a press, and a press on its row again closes it.
29
+ - A system panel's button on the system bar stays lit while its panel is open (its HTML button carries `aria-pressed`).
30
+ - Nothing is heard before the scene is shown: the effect voices (traffic, street lights, effects) and Babylon's own sounds stay silent until the loading spinner gives way. `holdEffectAudio()` (from `tosijs-3d/effect-audio`) holds them for a page's own reasons.
31
+ - The settings panel no longer has a Slow motion button. Set `timeScale` from a page that wants one.
32
+
33
+ ### Fixed
34
+
35
+ - In a headset, a system panel whose content grows after it opens (the rig tool once a body is rigged, the tailor) grows downward from under the system bar. It used to grow about its centre, up over the bar. `attachFramePanel` takes `keepTop: true` for this.
36
+ - A trackpad pinch sent as ctrl-wheel notches (many Windows trackpad drivers) zooms one wheel step a notch; each notch used to move the camera about twenty times as far.
37
+ - `<tosi-b3d-launcher>`'s `reloadModel()` no longer disposes the library's materials with the old model: after the first weapon swap, every weapon from that library was drawn white (the Biped Playground's loadout). `<tosi-b3d-crowd>`'s actors had the same fault when removed.
38
+ - `<tosi-b3d-hud>`: changing `size` resizes the HUD straight away; it used to wait for the next window resize. Any `handleResize()` call made after setting it can go.
39
+ - `<tosi-b3d-sound>` removed while its file loads no longer throws an unhandled rejection ("No volume subnode"); it is disposed once Babylon has finished loading it, and never starts playing.
40
+ - Removing a `<tosi-b3d>` no longer warns "WebGL context LOST": the teardown loses the context on purpose. An unexpected loss still warns.
41
+ - A skybox with its own `<tosi-b3d-moon>`s takes its night light from the brightest moon above the horizon. A moon that has set no longer lights the ground from below, and with every moon set the night has only ambient light.
42
+ - In a headset, a press on the hand that is not pointing now counts on every way into VR (`enterXR` and the biped's own XR camera), not only `<tosi-b3d>`'s.
43
+ - A popup whose content changes shape after it opens follows the new shape. It used to be drawn stretched or squashed until it was closed and opened again.
44
+ - The tailor: an outline that lies past the outline field (one carried over from another body) is clipped to the field, and its points are drawn at the field's edge so you can drag them back. It used to draw over the panel's buttons.
45
+ - In a headset, the system bar follows its panels during the session: a menu that leaves the bar (`viewMenu`) or a panel added late now does so in VR too. It used to keep the buttons it had when you entered.
46
+ - A select (or other popup) in a system panel opens on its own surface in front of the panel instead of being cropped inside it.
47
+ - The biped's aim reticle and the shadow blob under characters and vehicles are never culled. They used to vanish when the spot where they were created went out of view (in a headset, sometimes from one eye only).
48
+ - In a headset, the vehicle chase camera keeps its seat through a brief moment with nothing piloted. It used to take wherever you were looking as forward again, a re-seat you did not ask for.
@@ -0,0 +1,13 @@
1
+ import * as BABYLON from '@babylonjs/core';
2
+ export interface AimSpineOptions {
3
+ /** 0..1: how much of the correction to apply. Default 1. */
4
+ weight?: number;
5
+ /** The largest turn, degrees, over the whole chain. Default 70. */
6
+ maxDeg?: number;
7
+ }
8
+ /**
9
+ * Turn `chain` so `held` points along `target`. Returns the angle, degrees,
10
+ * left between them afterwards (0 when it got there).
11
+ */
12
+ export declare function aimSpine(chain: BABYLON.TransformNode[], held: BABYLON.TransformNode, target: BABYLON.Vector3, options?: AimSpineOptions): number;
13
+ //# sourceMappingURL=aim-ik.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aim-ik.d.ts","sourceRoot":"","sources":["../src/aim-ik.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAyBD;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE,EAC9B,IAAI,EAAE,OAAO,CAAC,aAAa,EAC3B,MAAM,EAAE,OAAO,CAAC,OAAO,EACvB,OAAO,GAAE,eAAoB,GAC5B,MAAM,CA0DR"}
package/dist/aim-ik.js ADDED
@@ -0,0 +1,111 @@
1
+ /*#
2
+ # aim IK
3
+
4
+ **Point what is held where the aim goes**, by turning the spine after the
5
+ clips have posed the body. An aim pose is drawn standing; laid over a crouch it
6
+ leans with the crouch's hips, and the gun points at the floor. This measures
7
+ where the held thing actually points and turns the spine bones, a share each,
8
+ until it points along the aim.
9
+
10
+ ```javascript
11
+ import { aimSpine } from 'tosijs-3d'
12
+
13
+ // Each frame, after the animations (scene.onAfterAnimationsObservable):
14
+ aimSpine([spine01, spine02, spine03], gun, aimDirection, { weight: 1, maxDeg: 70 })
15
+ ```
16
+
17
+ - `chain`: the bones to turn, root first (their TransformNodes, which a glTF
18
+ skeleton's bones are linked to)
19
+ - `held`: a node below the chain whose `forward` (its +Z) is the barrel
20
+ - `target`: the world direction to point along
21
+ - `weight` 0..1 eases it in and out; `maxDeg` caps the turn, so a target
22
+ behind the body turns the spine only so far
23
+
24
+ It works on directions in each bone's parent's frame, so a glTF root's
25
+ handedness mirror and a uniform scale make no difference. `<tosi-b3d-biped>`
26
+ runs it on its spine while it holds a weapon in `gunplay`.
27
+ */
28
+ /*{ "parent": "aim" }*/
29
+ import * as BABYLON from '@babylonjs/core';
30
+ /** The nodes from `node` up to (not including) `top`, top first. */
31
+ function pathBelow(top, node) {
32
+ const path = [];
33
+ let n = node;
34
+ while (n != null && n !== top) {
35
+ path.unshift(n);
36
+ n = n.parent;
37
+ }
38
+ return n === top ? path : null;
39
+ }
40
+ function refresh(nodes) {
41
+ for (const n of nodes)
42
+ n.computeWorldMatrix(true);
43
+ }
44
+ const unit = (v) => {
45
+ const l = v.length();
46
+ return l > 1e-9 ? v.scale(1 / l) : null;
47
+ };
48
+ /**
49
+ * Turn `chain` so `held` points along `target`. Returns the angle, degrees,
50
+ * left between them afterwards (0 when it got there).
51
+ */
52
+ export function aimSpine(chain, held, target, options = {}) {
53
+ const weight = Math.max(0, Math.min(1, options.weight ?? 1));
54
+ const maxRad = ((options.maxDeg ?? 70) * Math.PI) / 180;
55
+ const want = unit(target);
56
+ if (want == null || chain.length === 0)
57
+ return 0;
58
+ const top = chain[0].parent;
59
+ const below = top != null ? pathBelow(top, held) : null;
60
+ if (top == null || below == null)
61
+ return 0;
62
+ const all = [top, ...below];
63
+ refresh(all);
64
+ const pointing = () => unit(held.getWorldMatrix().getRow(2).toVector3());
65
+ const now = pointing();
66
+ if (now == null)
67
+ return 0;
68
+ const total = Math.acos(Math.max(-1, Math.min(1, BABYLON.Vector3.Dot(now, want))));
69
+ // The whole correction, capped and weighted, shared down the chain.
70
+ let left = Math.min(total, maxRad) * weight;
71
+ for (let k = 0; k < chain.length && left > 1e-5; k++) {
72
+ const bone = chain[k];
73
+ const parent = bone.parent;
74
+ if (parent == null || bone.rotationQuaternion == null)
75
+ continue;
76
+ const from = pointing();
77
+ if (from == null)
78
+ break;
79
+ // The two directions in the bone's PARENT's frame: a turn there is a turn
80
+ // of this bone's local rotation, whatever mirror sits above.
81
+ const inv = parent.getWorldMatrix().clone().invert();
82
+ const a = unit(BABYLON.Vector3.TransformNormal(from, inv));
83
+ const b = unit(BABYLON.Vector3.TransformNormal(want, inv));
84
+ if (a == null || b == null)
85
+ break;
86
+ const axis = unit(BABYLON.Vector3.Cross(a, b));
87
+ const between = Math.acos(Math.max(-1, Math.min(1, BABYLON.Vector3.Dot(a, b))));
88
+ if (axis == null || between < 1e-5)
89
+ break;
90
+ const share = Math.min(between, left / (chain.length - k));
91
+ // Which way round Babylon's axis-angle turns is checked, not assumed.
92
+ let turn = BABYLON.Matrix.RotationAxis(axis, share);
93
+ const test = BABYLON.Vector3.TransformNormal(a, turn);
94
+ if (BABYLON.Vector3.Dot(test, b) < Math.cos(between - share) - 1e-4) {
95
+ turn = BABYLON.Matrix.RotationAxis(axis, -share);
96
+ }
97
+ // Row vectors: the local rotation, then the turn in the parent's frame.
98
+ const local = new BABYLON.Matrix();
99
+ bone.rotationQuaternion.toRotationMatrix(local);
100
+ BABYLON.Quaternion.FromRotationMatrixToRef(local.multiply(turn), bone.rotationQuaternion);
101
+ left -= share;
102
+ refresh(all.slice(all.indexOf(bone)));
103
+ }
104
+ const after = pointing();
105
+ return after == null
106
+ ? 0
107
+ : (Math.acos(Math.max(-1, Math.min(1, BABYLON.Vector3.Dot(after, want)))) *
108
+ 180) /
109
+ Math.PI;
110
+ }
111
+ //# sourceMappingURL=aim-ik.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aim-ik.js","sourceRoot":"","sources":["../src/aim-ik.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BE;AACF,uBAAuB;AAEvB,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAS1C,oEAAoE;AACpE,SAAS,SAAS,CAChB,GAAiB,EACjB,IAAkB;IAElB,MAAM,IAAI,GAA4B,EAAE,CAAA;IACxC,IAAI,CAAC,GAAwB,IAAI,CAAA;IACjC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAC9B,IAAI,CAAC,OAAO,CAAC,CAA0B,CAAC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EAAE,CAAC,KAAK,CAAC,CAAA;QAClD,CAAC;QACD,wEAAwE;QACxE,MAAM,KAAK,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,CAAA;QAClC,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;QAC/C,OAAO,CAAC,UAAU,CAAC,uBAAuB,CACxC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EACpB,IAAI,CAAC,kBAAkB,CACxB,CAAA;QACD,IAAI,IAAI,KAAK,CAAA;QACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACvC,CAAC;IACD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,OAAO,KAAK,IAAI,IAAI;QAClB,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;YACrE,GAAG,CAAC;YACJ,IAAI,CAAC,EAAE,CAAA;AACf,CAAC"}
@@ -655,6 +655,11 @@ export declare class B3dBiped extends B3dControllable {
655
655
  private _aimLayer;
656
656
  private _aimLayerKey;
657
657
  private _updateAimLayer;
658
+ private _aimIkObs;
659
+ private _aimIkWeight;
660
+ private _aimIkChain;
661
+ private _aimIkOf;
662
+ private _aimIk;
658
663
  /** Seconds left of the one-shot fire pose. */
659
664
  private _shootFor;
660
665
  private _eased;
@@ -1 +1 @@
1
- {"version":3,"file":"b3d-biped.d.ts","sourceRoot":"","sources":["../src/b3d-biped.ts"],"names":[],"mappings":"AAoTA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EACL,OAAO,EAKR,MAAM,gBAAgB,CAAA;AAyBv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AAE,MAAM,GAAG,IAAI;IAQ/B,8EAA8E;IAC9E,YAAY,EAAE,OAAO,CAAO;IAC5B,4FAA4F;IAC5F,MAAM,EAAE,GAAG,CAAO;IAElB,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK;YAsC7B,cAAc;YAYd,cAAc;IAkI5B,OAAO,CAAC,WAAW;IAkFnB,YAAY;IA+CZ,MAAM;CA6BP;AAED,eAAO,MAAM,QAAQ,2CAA4B,CAAA"}
package/dist/b3d-biped.js CHANGED
@@ -306,13 +306,14 @@ on: under when you swim under, above otherwise.
306
306
  */
307
307
  /*{ "parent": "characters-and-vehicles", "order": 10 }*/
308
308
  import * as BABYLON from '@babylonjs/core';
309
- import { collidable, isOff, markUiMesh, refuseOwnAncestor, } from './b3d-utils.js';
309
+ import { collidable, isOff, markUiMesh, pressWithEitherHand, refuseOwnAncestor, sceneDelta, } from './b3d-utils.js';
310
310
  import { CLIMB_PHASE, canMantle, mantleClip, mantlePath, defaultMantleLimits, } from './mantle.js';
311
311
  import { buoyantStep, diveBuoyancy, submergedFraction, isSwimming, swimBuoyancy, } from './buoyancy.js';
312
312
  import { aimFromLook, clampAim, easeAim, aimTarget, surfaceAimLimit, } from './swim-aim.js';
313
313
  import { iceSide } from './water-shore.js';
314
314
  import { fitChase } from './camera-fit.js';
315
315
  import { DEFAULT_AIM_LIMITS, aimDirection as aimToDirection, aimPoseWeights, bodyCatchUp, relaxAim, stepAim, wrapDeg, } from './aim.js';
316
+ import { aimSpine } from './aim-ik.js';
316
317
  import { xrControllers } from './gamepad.js';
317
318
  import { B3dControllable } from './b3d-controllable.js';
318
319
  import { CompositeInputProvider } from './control-input.js';
@@ -1067,7 +1068,11 @@ export class B3dBiped extends B3dControllable {
1067
1068
  mat.zOffset = -8;
1068
1069
  this._reticle.material = mat;
1069
1070
  this._reticle.isPickable = false;
1071
+ // It moves every frame and its bounds are never synced, so it is never
1072
+ // culled: the bounds stayed where it was made, and the sight vanished
1073
+ // whenever that spot was out of view (in a headset, out of one eye's).
1070
1074
  this._reticle.doNotSyncBoundingInfo = true;
1075
+ this._reticle.alwaysSelectAsActiveMesh = true;
1071
1076
  markUiMesh(this._reticle);
1072
1077
  }
1073
1078
  const origin = this.aimOrigin;
@@ -1770,6 +1775,50 @@ export class B3dBiped extends B3dControllable {
1770
1775
  this._aimLayer = layerOnUpperBody(scene, skeleton, baseGroup, layerGroup);
1771
1776
  this._aimLayer?.play(layerClip !== 'Pistol_Shoot');
1772
1777
  }
1778
+ /*
1779
+ THE GUN POINTS WHERE THE AIM GOES, whatever the legs are doing. The aim
1780
+ poses are drawn standing; over a crouch they lean with its hips (the gun
1781
+ pointed 56° down at a level aim) and even standing it sat 11° low. So after
1782
+ the clips have posed the body, `aimSpine` turns the spine until the held
1783
+ weapon points along `aimDirection`. Eased in and out over `blendSeconds`.
1784
+ */
1785
+ _aimIkObs = null;
1786
+ _aimIkWeight = 0;
1787
+ _aimIkChain = null;
1788
+ _aimIkOf = null;
1789
+ _aimIk(scene) {
1790
+ const skeleton = this.entries?.skeletons?.[0] ?? null;
1791
+ const held = this._weapons().find((w) => w.socketed === true)?.mesh;
1792
+ const want = this.gunplay && held != null && !this._swimming ? 1 : 0;
1793
+ const blend = Math.max(0, this.blendSeconds ?? 0.25);
1794
+ const dt = sceneDelta(scene);
1795
+ this._aimIkWeight =
1796
+ blend > 0
1797
+ ? want > this._aimIkWeight
1798
+ ? Math.min(want, this._aimIkWeight + dt / blend)
1799
+ : Math.max(want, this._aimIkWeight - dt / blend)
1800
+ : want;
1801
+ if (this._aimIkWeight <= 0 || skeleton == null || held == null)
1802
+ return;
1803
+ if (this._aimIkOf !== skeleton) {
1804
+ this._aimIkOf = skeleton;
1805
+ const node = (names) => {
1806
+ const bone = skeleton.bones.find((b) => names.includes(b.name));
1807
+ return bone?.getTransformNode() ?? null;
1808
+ };
1809
+ const chain = [
1810
+ node(['spine_01', 'mixamorig:Spine', 'Spine']),
1811
+ node(['spine_02', 'mixamorig:Spine1', 'Spine1']),
1812
+ node(['spine_03', 'mixamorig:Spine2', 'Spine2']),
1813
+ ].filter((n) => n != null);
1814
+ this._aimIkChain = chain.length > 0 ? chain : null;
1815
+ }
1816
+ if (this._aimIkChain == null)
1817
+ return;
1818
+ aimSpine(this._aimIkChain, held, this.aimDirection, {
1819
+ weight: this._aimIkWeight,
1820
+ });
1821
+ }
1773
1822
  /** Seconds left of the one-shot fire pose. */
1774
1823
  _shootFor = 0;
1775
1824
  /*
@@ -3108,6 +3157,8 @@ export class B3dBiped extends B3dControllable {
3108
3157
  // The right hand points first (see tosi-b3d: otherwise a first press is lost).
3109
3158
  pointerSelectionOptions: { preferredHandedness: 'right' },
3110
3159
  });
3160
+ if (xr.pointerSelection != null)
3161
+ pressWithEitherHand(xr, scene);
3111
3162
  // Register controller observables BEFORE entering XR so we catch controller connect events
3112
3163
  this.setupXRInput(xr);
3113
3164
  // Now enter XR
@@ -3387,6 +3438,7 @@ export class B3dBiped extends B3dControllable {
3387
3438
  figure = null;
3388
3439
  sceneReady(owner, scene) {
3389
3440
  super.sceneReady(owner, scene);
3441
+ this._aimIkObs = scene.onAfterAnimationsObservable.add(() => this._aimIk(scene));
3390
3442
  const attrs = this;
3391
3443
  if ((attrs.character !== '' || this.characterDoc != null) &&
3392
3444
  !this.entries) {
@@ -3608,6 +3660,12 @@ export class B3dBiped extends B3dControllable {
3608
3660
  this.queueRender();
3609
3661
  }
3610
3662
  sceneDispose() {
3663
+ if (this._aimIkObs != null) {
3664
+ this.owner?.scene.onAfterAnimationsObservable.remove(this._aimIkObs);
3665
+ this._aimIkObs = null;
3666
+ }
3667
+ this._aimIkOf = null;
3668
+ this._aimIkChain = null;
3611
3669
  this._reticle?.dispose();
3612
3670
  this._reticle = null;
3613
3671
  // The layer owns AnimationGroups it built; the source clips are the GLB's