tosijs-3d 0.7.2 → 0.7.4
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.
- package/CHANGELOG.md +900 -0
- package/dist/b3d-aircraft.d.ts +14 -0
- package/dist/b3d-aircraft.d.ts.map +1 -1
- package/dist/b3d-aircraft.js +45 -0
- package/dist/b3d-aircraft.js.map +1 -1
- package/dist/b3d-ambient.d.ts +12 -0
- package/dist/b3d-ambient.d.ts.map +1 -1
- package/dist/b3d-ambient.js +83 -1
- package/dist/b3d-ambient.js.map +1 -1
- package/dist/b3d-biped.d.ts +290 -0
- package/dist/b3d-biped.d.ts.map +1 -1
- package/dist/b3d-biped.js +1366 -22
- package/dist/b3d-biped.js.map +1 -1
- package/dist/b3d-collisions.d.ts.map +1 -1
- package/dist/b3d-collisions.js +45 -7
- package/dist/b3d-collisions.js.map +1 -1
- package/dist/b3d-controllable.d.ts +50 -0
- package/dist/b3d-controllable.d.ts.map +1 -1
- package/dist/b3d-controllable.js +61 -0
- package/dist/b3d-controllable.js.map +1 -1
- package/dist/b3d-death.d.ts +26 -0
- package/dist/b3d-death.d.ts.map +1 -1
- package/dist/b3d-death.js +224 -2
- package/dist/b3d-death.js.map +1 -1
- package/dist/b3d-interactive.d.ts +80 -0
- package/dist/b3d-interactive.d.ts.map +1 -0
- package/dist/b3d-interactive.js +284 -0
- package/dist/b3d-interactive.js.map +1 -0
- package/dist/b3d-library.d.ts +39 -0
- package/dist/b3d-library.d.ts.map +1 -1
- package/dist/b3d-library.js +67 -0
- package/dist/b3d-library.js.map +1 -1
- package/dist/b3d-svg-plane.d.ts +35 -0
- package/dist/b3d-svg-plane.d.ts.map +1 -1
- package/dist/b3d-svg-plane.js +96 -8
- package/dist/b3d-svg-plane.js.map +1 -1
- package/dist/b3d-water.d.ts.map +1 -1
- package/dist/b3d-water.js +32 -6
- package/dist/b3d-water.js.map +1 -1
- package/dist/buoyancy.d.ts +90 -0
- package/dist/buoyancy.d.ts.map +1 -0
- package/dist/buoyancy.js +150 -0
- package/dist/buoyancy.js.map +1 -0
- package/dist/curve-field.d.ts +39 -0
- package/dist/curve-field.d.ts.map +1 -0
- package/dist/curve-field.js +491 -0
- package/dist/curve-field.js.map +1 -0
- package/dist/curve.d.ts +241 -0
- package/dist/curve.d.ts.map +1 -0
- package/dist/curve.js +559 -0
- package/dist/curve.js.map +1 -0
- package/dist/dialog-placement.d.ts +69 -7
- package/dist/dialog-placement.d.ts.map +1 -1
- package/dist/dialog-placement.js +90 -9
- package/dist/dialog-placement.js.map +1 -1
- package/dist/embed-font.d.ts +48 -0
- package/dist/embed-font.d.ts.map +1 -0
- package/dist/embed-font.js +135 -0
- package/dist/embed-font.js.map +1 -0
- package/dist/footprint-field.d.ts +30 -0
- package/dist/footprint-field.d.ts.map +1 -0
- package/dist/footprint-field.js +256 -0
- package/dist/footprint-field.js.map +1 -0
- package/dist/frame-panel.d.ts.map +1 -1
- package/dist/frame-panel.js +15 -12
- package/dist/frame-panel.js.map +1 -1
- package/dist/glb-manifest.d.ts +75 -0
- package/dist/glb-manifest.d.ts.map +1 -0
- package/dist/glb-manifest.js +198 -0
- package/dist/glb-manifest.js.map +1 -0
- package/dist/icon-data.d.ts.map +1 -1
- package/dist/icon-data.js +20 -1
- package/dist/icon-data.js.map +1 -1
- package/dist/index.d.ts +33 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -3
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +66 -0
- package/dist/interaction.d.ts.map +1 -0
- package/dist/interaction.js +117 -0
- package/dist/interaction.js.map +1 -0
- package/dist/interactive-behavior.d.ts +105 -0
- package/dist/interactive-behavior.d.ts.map +1 -0
- package/dist/interactive-behavior.js +253 -0
- package/dist/interactive-behavior.js.map +1 -0
- package/dist/key-layout.d.ts +70 -0
- package/dist/key-layout.d.ts.map +1 -1
- package/dist/key-layout.js +122 -0
- package/dist/key-layout.js.map +1 -1
- package/dist/keyboard-gamepad.d.ts.map +1 -1
- package/dist/keyboard-gamepad.js +19 -6
- package/dist/keyboard-gamepad.js.map +1 -1
- package/dist/keyboard.d.ts +100 -1
- package/dist/keyboard.d.ts.map +1 -1
- package/dist/keyboard.js +280 -35
- package/dist/keyboard.js.map +1 -1
- package/dist/mantle.d.ts +56 -0
- package/dist/mantle.d.ts.map +1 -0
- package/dist/mantle.js +115 -0
- package/dist/mantle.js.map +1 -0
- package/dist/popup-surface.d.ts +5 -1
- package/dist/popup-surface.d.ts.map +1 -1
- package/dist/popup-surface.js +181 -14
- package/dist/popup-surface.js.map +1 -1
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +111 -15
- package/dist/surface.js.map +1 -1
- package/dist/svg-icons.d.ts.map +1 -1
- package/dist/svg-icons.js +13 -1
- package/dist/svg-icons.js.map +1 -1
- package/dist/svg-texture.d.ts.map +1 -1
- package/dist/svg-texture.js +40 -1
- package/dist/svg-texture.js.map +1 -1
- package/dist/swim-aim.d.ts +78 -0
- package/dist/swim-aim.d.ts.map +1 -0
- package/dist/swim-aim.js +140 -0
- package/dist/swim-aim.js.map +1 -0
- package/dist/theme-editor.d.ts +41 -0
- package/dist/theme-editor.d.ts.map +1 -0
- package/dist/theme-editor.js +303 -0
- package/dist/theme-editor.js.map +1 -0
- package/dist/tosi-b3d.d.ts +24 -4
- package/dist/tosi-b3d.d.ts.map +1 -1
- package/dist/tosi-b3d.js +238 -37
- package/dist/tosi-b3d.js.map +1 -1
- package/dist/vector-field.d.ts +58 -0
- package/dist/vector-field.d.ts.map +1 -0
- package/dist/vector-field.js +321 -0
- package/dist/vector-field.js.map +1 -0
- package/dist/virtual-gamepad.d.ts.map +1 -1
- package/dist/virtual-gamepad.js +46 -9
- package/dist/virtual-gamepad.js.map +1 -1
- package/dist/w3d-theme.d.ts +115 -17
- package/dist/w3d-theme.d.ts.map +1 -1
- package/dist/w3d-theme.js +311 -0
- package/dist/w3d-theme.js.map +1 -1
- package/dist/water-normal.d.ts +26 -0
- package/dist/water-normal.d.ts.map +1 -0
- package/dist/water-normal.js +105 -0
- package/dist/water-normal.js.map +1 -0
- package/dist/widgets3d-layout.d.ts +58 -0
- package/dist/widgets3d-layout.d.ts.map +1 -1
- package/dist/widgets3d-layout.js +79 -1
- package/dist/widgets3d-layout.js.map +1 -1
- package/dist/widgets3d.d.ts +51 -2
- package/dist/widgets3d.d.ts.map +1 -1
- package/dist/widgets3d.js +418 -112
- package/dist/widgets3d.js.map +1 -1
- package/dist/wreck-fall.d.ts +86 -0
- package/dist/wreck-fall.d.ts.map +1 -0
- package/dist/wreck-fall.js +129 -0
- package/dist/wreck-fall.js.map +1 -0
- package/package.json +9 -6
package/dist/b3d-biped.d.ts
CHANGED
|
@@ -20,6 +20,29 @@ export declare class AnimState {
|
|
|
20
20
|
constructor(spec: AnimStateSpec);
|
|
21
21
|
static buildList(...specs: AnimStateSpec[]): AnimState[];
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* **Animation states for a Quaternius UAL rig** (the Universal Animation
|
|
25
|
+
* Library, on `cdn.tosijs.net/quaternius/`).
|
|
26
|
+
*
|
|
27
|
+
* The biped drives states by NAME — `walk`, `run`, `sneak` — and a rig supplies
|
|
28
|
+
* whatever its animator called them. This is the translation for UAL, so
|
|
29
|
+
* adopting that library is one line:
|
|
30
|
+
*
|
|
31
|
+
* ```js
|
|
32
|
+
* b3dBiped({
|
|
33
|
+
* url: assetUrl('quaternius/UAL1_core.glb'),
|
|
34
|
+
* animationStates: ualAnimationStates(),
|
|
35
|
+
* })
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* Two things it buys beyond names. `walkBackwards` becomes a real
|
|
39
|
+
* `Jog_Bwd_Loop` rather than the walk cycle played in reverse, and `sneak` gets
|
|
40
|
+
* a crouch that holds at rest — both were fakes against the stock rig.
|
|
41
|
+
*
|
|
42
|
+
* Pass `extra` to add or override entries; a later entry with the same `name`
|
|
43
|
+
* wins, so a project can retarget one state without restating the rest.
|
|
44
|
+
*/
|
|
45
|
+
export declare function ualAnimationStates(extra?: AnimStateSpec[]): AnimState[];
|
|
23
46
|
export declare class B3dBiped extends B3dControllable {
|
|
24
47
|
static initAttributes: {
|
|
25
48
|
url: string;
|
|
@@ -40,6 +63,100 @@ export declare class B3dBiped extends B3dControllable {
|
|
|
40
63
|
cameraMaxFollowDistance: number;
|
|
41
64
|
groundY: number;
|
|
42
65
|
eyeHeight: number;
|
|
66
|
+
/** Degrees per second the right stick swings the view. */
|
|
67
|
+
lookRate: number;
|
|
68
|
+
/** How far up/down the look can go, degrees. */
|
|
69
|
+
maxLookPitch: number;
|
|
70
|
+
/**
|
|
71
|
+
* Invert the right stick's vertical. **On by default** — Tonio's call, and
|
|
72
|
+
* the conventional one for a third-person camera: pushing the stick away
|
|
73
|
+
* from you tips the view DOWN, the way a physical camera head works. Set
|
|
74
|
+
* `'off'` for the direct mapping.
|
|
75
|
+
*
|
|
76
|
+
* A string enum rather than a boolean because an absent boolean attribute
|
|
77
|
+
* is false, so a default-true boolean can never turn on (and tosijs now
|
|
78
|
+
* throws on one) — see CLAUDE.md.
|
|
79
|
+
*/
|
|
80
|
+
invertLookY: "on" | "off";
|
|
81
|
+
/**
|
|
82
|
+
* Never let the follow camera drop below this above the character's feet.
|
|
83
|
+
* Pitch drives the camera's HEIGHT, so looking up walks it downward — and
|
|
84
|
+
* without a floor it ends up underground, which reads as the world
|
|
85
|
+
* vanishing. Metres.
|
|
86
|
+
*/
|
|
87
|
+
cameraMinHeight: number;
|
|
88
|
+
/**
|
|
89
|
+
* Upward speed of a FULLY wound-up jump, m/s. The physics is fixed and the
|
|
90
|
+
* ANIMATION is retimed to match it — not the other way round. Matching the
|
|
91
|
+
* jump to the clip was tried and was wrong: it made the jump a consequence
|
|
92
|
+
* of whatever the animator exported.
|
|
93
|
+
*/
|
|
94
|
+
jumpSpeed: number;
|
|
95
|
+
/** Fraction of walking speed while sneaking. */
|
|
96
|
+
sneakSpeed: number;
|
|
97
|
+
/** Sidestep speed as a fraction of walking. Slower than forward on purpose. */
|
|
98
|
+
strafeSpeed: number;
|
|
99
|
+
/**
|
|
100
|
+
* `'on'` to sidestep with the left stick, `'off'` (default) to turn with it
|
|
101
|
+
* instead — both sticks then steer and the sidestep clips never play.
|
|
102
|
+
*
|
|
103
|
+
* Off by default on principle rather than as a workaround: strafing is a
|
|
104
|
+
* shooter idiom that reads oddly on a character meant to move like a
|
|
105
|
+
* person. That it also avoids the weakest clips in the Quaternius set is a
|
|
106
|
+
* bonus, not the reason.
|
|
107
|
+
*
|
|
108
|
+
* A string enum rather than a boolean because a boolean attribute cannot
|
|
109
|
+
* default to true, and the useful default here is "strafing off".
|
|
110
|
+
*/
|
|
111
|
+
/**
|
|
112
|
+
* **How deep the water gets before you swim, as a fraction of standing
|
|
113
|
+
* height.** Below this you wade — feet on the bottom, walking; above it
|
|
114
|
+
* buoyancy takes over.
|
|
115
|
+
*
|
|
116
|
+
* `0.45` is about 0.8 m on a 1.83 m rig. Tonio set the band: *"make it
|
|
117
|
+
* about 0.4-0.5 (it's hard to swim in water less than waist deep)"* — which
|
|
118
|
+
* is the real constraint. Swimming shallower than that is not a choice a
|
|
119
|
+
* person gets to make; the bottom is in the way.
|
|
120
|
+
*
|
|
121
|
+
* A fraction rather than metres because it is a fact about the BODY — a
|
|
122
|
+
* smaller character should start swimming sooner in the same pond, and a
|
|
123
|
+
* fraction tracks that for free. Metres would be right for a fact about the
|
|
124
|
+
* WORLD; the two are easy to confuse and worth keeping apart.
|
|
125
|
+
*
|
|
126
|
+
* Leaving the water uses a lower threshold (70% of this) so the boundary
|
|
127
|
+
* does not flicker; see `buoyancy.isSwimming`.
|
|
128
|
+
*/
|
|
129
|
+
/**
|
|
130
|
+
* **How high a ledge the character can pull itself onto, metres.** Below
|
|
131
|
+
* `STEP_UP` (0.5) the walking code just steps up; above this it is a wall.
|
|
132
|
+
*
|
|
133
|
+
* `2.2` is a touch over shoulder height on a 1.83 m rig — a decent mantle
|
|
134
|
+
* for someone athletic. Lower it for a heavier or clumsier character; that
|
|
135
|
+
* is the mobility half of the skill dial AI-DESIGN argues for, and it costs
|
|
136
|
+
* nothing to expose because the band it defines is read from geometry
|
|
137
|
+
* rather than painted onto it.
|
|
138
|
+
*/
|
|
139
|
+
climbReach: number;
|
|
140
|
+
wadeDepth: number;
|
|
141
|
+
strafing: string;
|
|
142
|
+
/**
|
|
143
|
+
* **How high this figure rides in the water, in METRES.** `0` (default)
|
|
144
|
+
* puts the waterline at the head — what swimming means — and it is a
|
|
145
|
+
* straight vertical offset from there: `0.1` floats ten centimetres
|
|
146
|
+
* higher, `-0.1` ten lower.
|
|
147
|
+
*
|
|
148
|
+
* Metres rather than a dimensionless multiplier because a multiplier is not
|
|
149
|
+
* authorable — its effect depends on how tall the pose happens to be, so
|
|
150
|
+
* the same number means different things for a tread and a crawl, and you
|
|
151
|
+
* tune it by bisection. An offset is the thing you actually want to say:
|
|
152
|
+
* *this figure sits a bit lower in the water.* Tonio: *"we can keep
|
|
153
|
+
* buoyancy as a strict z offset for a given figure in water."*
|
|
154
|
+
*
|
|
155
|
+
* It is per-FIGURE, which is the useful axis — a heavy pack, armour, a
|
|
156
|
+
* different body — and it composes with any animation set, because the
|
|
157
|
+
* anchor it offsets from is measured rather than authored.
|
|
158
|
+
*/
|
|
159
|
+
buoyancy: number;
|
|
43
160
|
x: number;
|
|
44
161
|
y: number;
|
|
45
162
|
z: number;
|
|
@@ -74,9 +191,182 @@ export declare class B3dBiped extends B3dControllable {
|
|
|
74
191
|
private xrInputProvider?;
|
|
75
192
|
animationState?: AnimState;
|
|
76
193
|
animationGroup?: BABYLON.AnimationGroup;
|
|
194
|
+
/** Measured vertical extent of the body per animation clip. See `_poseExtent`. */
|
|
195
|
+
private _poseCache;
|
|
196
|
+
/** Seconds the current clip has been playing — a pose needs settling before measuring. */
|
|
197
|
+
private _poseAge;
|
|
198
|
+
/**
|
|
199
|
+
* The climb in progress, if any — a COMMITTED transition. Time-boxed by the
|
|
200
|
+
* clip and always exited, so it is not a mode you can be stuck in (the
|
|
201
|
+
* distinction MOBILITY-DESIGN draws about cover applies here too).
|
|
202
|
+
*/
|
|
203
|
+
/** Seconds until the ledge probe may run again — see the note at `_tryMantle`. */
|
|
204
|
+
private _ledgeCooldown;
|
|
205
|
+
private _mantle;
|
|
206
|
+
/** Samples in flight for the clip being measured — see `_currentPose`. */
|
|
207
|
+
private _poseAccum;
|
|
208
|
+
/** Last measured pose that hangs below its root, i.e. a swim pose. See the note in water. */
|
|
209
|
+
private _lastSwimPose;
|
|
77
210
|
gameController?: GameController;
|
|
211
|
+
/**
|
|
212
|
+
* Downward speed while airborne, m/s. One value per element rather than per
|
|
213
|
+
* root node: a character GLB has a single root, and sharing it across two
|
|
214
|
+
* would only matter for a rig that does not exist.
|
|
215
|
+
*/
|
|
216
|
+
private _fallVel;
|
|
217
|
+
/** True while in the water and off the bottom — see `buoyancy.isSwimming`. */
|
|
218
|
+
private _swimming;
|
|
219
|
+
/** Held aim while swimming, DEGREES, positive down — see [[swim-aim]]. */
|
|
220
|
+
private _swimAim;
|
|
221
|
+
/** The pitch actually applied to the body, eased toward `_swimAim`. */
|
|
222
|
+
private _swimPitch;
|
|
223
|
+
/** Whether the body carried a pitch last frame, so unwinding runs to zero. */
|
|
224
|
+
private _swimWasPitched;
|
|
225
|
+
/** Body yaw in radians while pitched — integrated, never read back. */
|
|
226
|
+
private _bodyYaw;
|
|
227
|
+
/**
|
|
228
|
+
* Camera/body pitch in degrees, positive up. There is no `_lookYaw`: the
|
|
229
|
+
* right stick turns the BODY now, so the camera has no yaw of its own.
|
|
230
|
+
*/
|
|
231
|
+
private _lookPitch;
|
|
232
|
+
private _sneaking;
|
|
233
|
+
/** Held the jump button while grounded: winding up, not yet launched. */
|
|
234
|
+
private _jumpWasDown;
|
|
235
|
+
/** Off the ground and not in water — the jump clip owns the animation. */
|
|
236
|
+
private _inAir;
|
|
237
|
+
private _jumpClip;
|
|
238
|
+
/**
|
|
239
|
+
* Which phase of the three-part jump is showing. `Jump_Start` is a takeoff,
|
|
240
|
+
* `Jump_Loop` holds you in the air however long the arc lasts, `Jump_Land`
|
|
241
|
+
* plays on touchdown — so the clips no longer have to be stretched to fit the
|
|
242
|
+
* flight, which is what `speedRatio` retiming was compensating for.
|
|
243
|
+
*/
|
|
244
|
+
private _airPhase;
|
|
245
|
+
private _phaseLeft;
|
|
246
|
+
/**
|
|
247
|
+
* How long an animation clip runs, in seconds — `0` if there is no such clip.
|
|
248
|
+
*
|
|
249
|
+
* `from`/`to` are FRAMES, so this needs the clip's own frame rate rather than
|
|
250
|
+
* an assumed 60: a 24 fps export would otherwise read as two and a half times
|
|
251
|
+
* too long and launch the character accordingly. `speedRatio` counts too,
|
|
252
|
+
* since the biped scales playback by movement speed.
|
|
253
|
+
*/
|
|
254
|
+
private _clipSeconds;
|
|
255
|
+
private _sneakWas;
|
|
256
|
+
/** Zoom 0..1, now integrated from the d-pad rather than read off a stick. */
|
|
257
|
+
private _camZoom;
|
|
258
|
+
private _waterEl;
|
|
259
|
+
/**
|
|
260
|
+
* Surface height of the scene's water, or `null` if there is none.
|
|
261
|
+
*
|
|
262
|
+
* Looked up lazily and cached — `undefined` means "not asked yet", `null`
|
|
263
|
+
* means "asked, no water", which is the common case and must cost nothing per
|
|
264
|
+
* frame. Read from the MESH rather than the element's `y`: water is
|
|
265
|
+
* viewer-centred and not origin-shifted, so the mesh is the honest answer.
|
|
266
|
+
*/
|
|
267
|
+
private _waterSurfaceY;
|
|
78
268
|
private xrCamZoom;
|
|
79
269
|
animationStates: AnimState[];
|
|
270
|
+
/**
|
|
271
|
+
* **How tall the body actually is, in the pose it is holding right now.**
|
|
272
|
+
*
|
|
273
|
+
* Returns the body's vertical extent relative to the root node — `bottom` is
|
|
274
|
+
* how far BELOW the root the lowest point is, `height` the full span — or
|
|
275
|
+
* `null` until a skinned mesh is available.
|
|
276
|
+
*
|
|
277
|
+
* This exists because the root node is only at the feet when the character is
|
|
278
|
+
* STANDING. Measured on the Quaternius rig: `Idle_Loop` spans 0 → 1.78 above
|
|
279
|
+
* the root, but `Swim_Idle_Loop` hangs the legs 1.37 m BELOW it and puts the
|
|
280
|
+
* head just 0.24 m above. Treating the root as the feet therefore floated a
|
|
281
|
+
* body that was not there and left the real head about 1.2 m under —
|
|
282
|
+
* Tonio: *"the biped is much lower when treading water relative to the old
|
|
283
|
+
* biped"*, which is exactly right and now measured rather than guessed.
|
|
284
|
+
*
|
|
285
|
+
* It also killed the `buoyancy` dial: getting that head out of the water
|
|
286
|
+
* needed a submersion of 0.14, i.e. `buoyancy ≈ 7`, so raising it to 2 moved
|
|
287
|
+
* the body and changed nothing anyone could see.
|
|
288
|
+
*
|
|
289
|
+
* **Measured, never authored.** A per-rig table of swim offsets would be the
|
|
290
|
+
* obvious alternative and is the wrong shape — it is `_cover` painting by
|
|
291
|
+
* another name (MOBILITY-DESIGN.md): a fact the geometry already knows, wired
|
|
292
|
+
* by hand, silently wrong for the next animation set. Since the numbers here
|
|
293
|
+
* come out of the pose itself, a Mixamo or Mocap rig with different
|
|
294
|
+
* proportions floats correctly with no tuning.
|
|
295
|
+
*
|
|
296
|
+
* Cost is one CPU skinning pass per CLIP, cached forever after — not per
|
|
297
|
+
* frame. `refreshBoundingInfo({applySkeleton:true})` is far too expensive to
|
|
298
|
+
* run continuously.
|
|
299
|
+
*/
|
|
300
|
+
private _poseExtent;
|
|
301
|
+
/**
|
|
302
|
+
* Height of the head bone above the root in the current pose, or `null` on a
|
|
303
|
+
* rig with no findable head. See `_swimWaterline` for what it is for.
|
|
304
|
+
*/
|
|
305
|
+
private _headOffset;
|
|
306
|
+
/**
|
|
307
|
+
* The extent for the clip currently playing, **averaged over a couple of
|
|
308
|
+
* seconds** rather than sampled once, and cached per clip.
|
|
309
|
+
*
|
|
310
|
+
* Averaging is not polish, it is the difference between working and not. A
|
|
311
|
+
* swim cycle is not a fixed shape: measured on `Swim_Fwd_Loop` (1.33 s), the
|
|
312
|
+
* body's lowest point swings from −1.26 to −0.28 as the legs kick — nearly a
|
|
313
|
+
* metre — and the head from −0.03 to +0.28. A single sample therefore lands
|
|
314
|
+
* wherever the settle timer happens to fall, and since the waterline is
|
|
315
|
+
* derived from `height / depth`, the shallow end of that swing produced a
|
|
316
|
+
* buoyancy at the clamp and fired the swimmer out of the water. Tonio: *"I
|
|
317
|
+
* seem to porpoise out of the water with a dead right stick"* — intermittent,
|
|
318
|
+
* because it depended on the phase, which is exactly how it read.
|
|
319
|
+
*
|
|
320
|
+
* Returns the running mean while it accumulates, so the value is usable
|
|
321
|
+
* immediately and merely gets better; it is committed to the cache once the
|
|
322
|
+
* window closes.
|
|
323
|
+
*/
|
|
324
|
+
private _currentPose;
|
|
325
|
+
/**
|
|
326
|
+
* **Where the water should sit on this pose**, expressed as the buoyancy that
|
|
327
|
+
* puts it there — a body rests at submersion `1 / buoyancy`, so the two are
|
|
328
|
+
* the same statement.
|
|
329
|
+
*
|
|
330
|
+
* The anchor is the **head**, because that is what swimming IS: a swimmer
|
|
331
|
+
* keeps their head at the surface, and does it by swimming rather than by
|
|
332
|
+
* floating. That makes this a fact about the activity rather than about a
|
|
333
|
+
* clip, so it holds for any humanoid rig — the head bone exists in all of
|
|
334
|
+
* them — and needs no per-animation-set tuning.
|
|
335
|
+
*
|
|
336
|
+
* It also beats the two conventions it sits between, both of which we tried.
|
|
337
|
+
* The root is not a reliable anchor because it means different things in
|
|
338
|
+
* different clips (Tonio: *"the whole root means two completely different
|
|
339
|
+
* things ... is quite problematic"*) — feet when standing, roughly waterline
|
|
340
|
+
* when swimming. Taking it literally floated this rig at ARMPIT height, since
|
|
341
|
+
* its root sits 73% up the treading pose: *"he's still floating way too
|
|
342
|
+
* high."* Anchoring at the head instead puts the water at the neck with the
|
|
343
|
+
* chin clear, which is what treading water looks like, and the same rule
|
|
344
|
+
* leaves a front crawl's head breaking the surface.
|
|
345
|
+
*
|
|
346
|
+
* Falls back to the root convention on a rig with no head bone, and to a
|
|
347
|
+
* plain physical ratio for a pose that does not hang below its root (i.e. a
|
|
348
|
+
* standing one, where there is no waterline being declared at all).
|
|
349
|
+
*
|
|
350
|
+
* Clamped, because `height / depth` diverges as the depth approaches zero and
|
|
351
|
+
* one mid-blend measurement would otherwise fire a swimmer out of the water.
|
|
352
|
+
*/
|
|
353
|
+
private _swimWaterline;
|
|
354
|
+
/**
|
|
355
|
+
* **Look for a lip in front of the character.** Two rays: one forward at shin
|
|
356
|
+
* height to find the face of the thing, one down from above the far side to
|
|
357
|
+
* find what you would be standing on.
|
|
358
|
+
*
|
|
359
|
+
* Returns `null` when there is nothing to read. Everything it does return is
|
|
360
|
+
* a MEASUREMENT — see `mantle.canMantle` for the decision, which is pure and
|
|
361
|
+
* tested, and see MOBILITY-DESIGN for why a `_climbable` suffix would be a
|
|
362
|
+
* bug rather than a shortcut.
|
|
363
|
+
*/
|
|
364
|
+
private _readLedge;
|
|
365
|
+
/**
|
|
366
|
+
* Try to start a climb. Returns true if one began, in which case the caller
|
|
367
|
+
* hands this frame over — a mantle owns the body until it finishes.
|
|
368
|
+
*/
|
|
369
|
+
private _tryMantle;
|
|
80
370
|
setAnimationState(name: string, speed?: number): void;
|
|
81
371
|
getCameraTarget(): BABYLON.Node | null;
|
|
82
372
|
applyInput(input: ControlInput, dt: number): void;
|
package/dist/b3d-biped.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"b3d-biped.d.ts","sourceRoot":"","sources":["../src/b3d-biped.ts"],"names":[],"mappings":"AA4GA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"b3d-biped.d.ts","sourceRoot":"","sources":["../src/b3d-biped.ts"],"names":[],"mappings":"AA4GA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAqB,MAAM,aAAa,CAAA;AAqBxD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,K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