tosijs-3d 0.12.3 → 0.12.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 +2 -2
- package/changelog/v0.12.4.md +48 -0
- package/dist/asset-url.d.ts +1 -1
- package/dist/asset-url.js +1 -1
- package/dist/b3d-biped.d.ts +19 -22
- package/dist/b3d-biped.d.ts.map +1 -1
- package/dist/b3d-biped.js +79 -5
- package/dist/b3d-biped.js.map +1 -1
- package/dist/b3d-car.js +1 -1
- package/dist/b3d-launcher.d.ts +0 -8
- package/dist/b3d-launcher.d.ts.map +1 -1
- package/dist/b3d-launcher.js +28 -1
- package/dist/b3d-launcher.js.map +1 -1
- package/dist/b3d-manipulator.d.ts +2 -0
- package/dist/b3d-manipulator.d.ts.map +1 -1
- package/dist/b3d-manipulator.js +66 -11
- package/dist/b3d-manipulator.js.map +1 -1
- package/dist/bar-menu.d.ts.map +1 -1
- package/dist/bar-menu.js +0 -2
- package/dist/bar-menu.js.map +1 -1
- package/dist/body-export.d.ts +41 -0
- package/dist/body-export.d.ts.map +1 -0
- package/dist/body-export.js +149 -0
- package/dist/body-export.js.map +1 -0
- package/dist/character-builder.d.ts.map +1 -1
- package/dist/character-builder.js +523 -192
- package/dist/character-builder.js.map +1 -1
- package/dist/character-file.d.ts +4 -0
- package/dist/character-file.d.ts.map +1 -1
- package/dist/character-file.js +15 -0
- package/dist/character-file.js.map +1 -1
- package/dist/character-settings.d.ts.map +1 -1
- package/dist/character-settings.js +2 -0
- package/dist/character-settings.js.map +1 -1
- package/dist/character-store.d.ts.map +1 -1
- package/dist/character-store.js +25 -2
- package/dist/character-store.js.map +1 -1
- package/dist/character.d.ts +4 -1
- package/dist/character.d.ts.map +1 -1
- package/dist/character.js +122 -11
- package/dist/character.js.map +1 -1
- package/dist/cloth-drape.d.ts +49 -3
- package/dist/cloth-drape.d.ts.map +1 -1
- package/dist/cloth-drape.js +170 -16
- package/dist/cloth-drape.js.map +1 -1
- package/dist/cloth-shading.d.ts.map +1 -1
- package/dist/cloth-shading.js +46 -11
- package/dist/cloth-shading.js.map +1 -1
- package/dist/color-field.d.ts +5 -0
- package/dist/color-field.d.ts.map +1 -1
- package/dist/color-field.js +27 -11
- package/dist/color-field.js.map +1 -1
- package/dist/color-picker.d.ts +6 -0
- package/dist/color-picker.d.ts.map +1 -1
- package/dist/color-picker.js +41 -2
- package/dist/color-picker.js.map +1 -1
- package/dist/fabric-textures.d.ts +19 -0
- package/dist/fabric-textures.d.ts.map +1 -0
- package/dist/fabric-textures.js +133 -0
- package/dist/fabric-textures.js.map +1 -0
- package/dist/game-controller.d.ts +3 -0
- package/dist/game-controller.d.ts.map +1 -1
- package/dist/game-controller.js +19 -0
- package/dist/game-controller.js.map +1 -1
- package/dist/garment-cut.d.ts +2 -0
- package/dist/garment-cut.d.ts.map +1 -1
- package/dist/garment-cut.js +184 -0
- package/dist/garment-cut.js.map +1 -1
- package/dist/hold-grip.d.ts +24 -0
- package/dist/hold-grip.d.ts.map +1 -0
- package/dist/hold-grip.js +101 -0
- package/dist/hold-grip.js.map +1 -0
- package/dist/icon-data.d.ts +13 -0
- package/dist/icon-data.d.ts.map +1 -1
- package/dist/icon-data.js +14 -1
- package/dist/icon-data.js.map +1 -1
- package/dist/index.d.ts +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/manipulator-view.d.ts +1 -1
- package/dist/manipulator-view.d.ts.map +1 -1
- package/dist/manipulator-view.js +7 -8
- package/dist/manipulator-view.js.map +1 -1
- package/dist/manipulator.d.ts +3 -1
- package/dist/manipulator.d.ts.map +1 -1
- package/dist/manipulator.js +40 -10
- package/dist/manipulator.js.map +1 -1
- package/dist/material-apply.d.ts +18 -0
- package/dist/material-apply.d.ts.map +1 -1
- package/dist/material-apply.js +53 -10
- package/dist/material-apply.js.map +1 -1
- package/dist/material-picker.d.ts +6 -0
- package/dist/material-picker.d.ts.map +1 -1
- package/dist/material-picker.js +254 -21
- package/dist/material-picker.js.map +1 -1
- package/dist/material-pictures.d.ts +13 -0
- package/dist/material-pictures.d.ts.map +1 -0
- package/dist/material-pictures.js +93 -0
- package/dist/material-pictures.js.map +1 -0
- package/dist/material-preview.d.ts +2 -2
- package/dist/material-preview.d.ts.map +1 -1
- package/dist/material-preview.js +72 -28
- package/dist/material-preview.js.map +1 -1
- package/dist/material-recipe.d.ts +10 -0
- package/dist/material-recipe.d.ts.map +1 -1
- package/dist/material-recipe.js +75 -7
- package/dist/material-recipe.js.map +1 -1
- package/dist/outline-field.d.ts +21 -0
- package/dist/outline-field.d.ts.map +1 -1
- package/dist/outline-field.js +74 -5
- package/dist/outline-field.js.map +1 -1
- package/dist/playback-field.d.ts +40 -0
- package/dist/playback-field.d.ts.map +1 -0
- package/dist/playback-field.js +315 -0
- package/dist/playback-field.js.map +1 -0
- package/dist/playground.d.ts.map +1 -1
- package/dist/playground.js +87 -54
- package/dist/playground.js.map +1 -1
- package/dist/remesh.d.ts +9 -0
- package/dist/remesh.d.ts.map +1 -1
- package/dist/remesh.js +17 -3
- package/dist/remesh.js.map +1 -1
- package/dist/retarget.js +1 -1
- package/dist/rig-fit.d.ts +10 -0
- package/dist/rig-fit.d.ts.map +1 -1
- package/dist/rig-fit.js +125 -0
- package/dist/rig-fit.js.map +1 -1
- package/dist/rig-recipe.d.ts +7 -1
- package/dist/rig-recipe.d.ts.map +1 -1
- package/dist/rig-recipe.js +7 -1
- package/dist/rig-recipe.js.map +1 -1
- package/dist/rig-tool.d.ts +7 -0
- package/dist/rig-tool.d.ts.map +1 -1
- package/dist/rig-tool.js +333 -49
- package/dist/rig-tool.js.map +1 -1
- package/dist/rigged-body.d.ts +5 -1
- package/dist/rigged-body.d.ts.map +1 -1
- package/dist/rigged-body.js +5 -2
- package/dist/rigged-body.js.map +1 -1
- package/dist/spring-chain-babylon.js +1 -1
- package/dist/svg-icons.d.ts +2 -3
- package/dist/svg-icons.d.ts.map +1 -1
- package/dist/svg-icons.js +8 -6
- package/dist/svg-icons.js.map +1 -1
- package/dist/tailor-tool.d.ts +27 -0
- package/dist/tailor-tool.d.ts.map +1 -1
- package/dist/tailor-tool.js +284 -80
- package/dist/tailor-tool.js.map +1 -1
- package/dist/tosi-b3d.d.ts +20 -1
- package/dist/tosi-b3d.d.ts.map +1 -1
- package/dist/tosi-b3d.js +70 -14
- package/dist/tosi-b3d.js.map +1 -1
- package/dist/undo-history.d.ts +19 -0
- package/dist/undo-history.d.ts.map +1 -0
- package/dist/undo-history.js +77 -0
- package/dist/undo-history.js.map +1 -0
- package/dist/w3d-theme.d.ts +2 -0
- package/dist/w3d-theme.d.ts.map +1 -1
- package/dist/w3d-theme.js +11 -0
- package/dist/w3d-theme.js.map +1 -1
- package/dist/weapon-fit.js +1 -1
- package/dist/widgets3d.d.ts +47 -16
- package/dist/widgets3d.d.ts.map +1 -1
- package/dist/widgets3d.js +98 -35
- package/dist/widgets3d.js.map +1 -1
- package/package.json +2 -2
- package/static/attributes.json +66 -1
- package/static/attributes.txt +20 -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.
|
|
15
|
+
## 0.12.4
|
|
16
16
|
|
|
17
|
-
The latest release.
|
|
17
|
+
The latest release. Tabbed settings panels and undo across the character builder, rig tool and tailor; pictures in materials (Poly Haven's fabric scans as cloth presets, a picture or a flat colour or grey for any input); the tailor always on the bar; grips per class of held item; Tonio's textured weapons and melee in the biped. See [0.12.4](/v0.12.4/).
|
|
18
18
|
|
|
19
19
|
## Every version
|
|
20
20
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# 0.12.4
|
|
2
|
+
|
|
3
|
+
<!--{ "parent": "CHANGELOG", "order": 9987996 }-->
|
|
4
|
+
|
|
5
|
+
Tabbed settings panels and undo across the character builder, rig tool and tailor; pictures in materials (Poly Haven's fabric scans as cloth presets, a picture or a flat colour or grey for any input); the tailor always on the bar; grips per class of held item; Tonio's textured weapons and melee in the biped.
|
|
6
|
+
|
|
7
|
+
Size: barrel (min, packages external) 1643.8 KB raw / 569.0 KB gz, up 47.8 KB / 14.0 KB gz (+3.0%) on 0.12.3: the material pictures and fabric presets, the drape's sliced runner, undo history, playback and hold grips are in the barrel.
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- **Tabbed settings panels with icons**: `panelSections: 'tabs'` with an `icon` on each collapsible `label3d`. The character builder and the rig tool use it.
|
|
12
|
+
- **`panelActions(el)`** on `<tosi-b3d>`: a page's own buttons on the settings panel's icon bar, at its right end. Icon bars take `{ spacer: true }` (an elastic gap); `tabs3d` takes `tools`, and in a tabbed panel `iconBar3d({ inTabs: true })` goes on the tab strip.
|
|
13
|
+
- **Undo and redo** in the character builder and the rig tool (⌘Z / ⇧⌘Z). `undoHistory` is the pure history behind them.
|
|
14
|
+
- **Panels rebuild once a resize settles.** The scene dispatches `resizeend`; `panelRoom(panelEl)` gives a system panel its room.
|
|
15
|
+
- **Pictures in materials**: a material picker's colour, opacity, glow and bumps (and a cloth's colour, roughness and normal) can take a picture, kept by `material-pictures` and saved in a character file (`pictures`). Cloth and PBR take `tile` (metres per repeat).
|
|
16
|
+
- **Photographed fabrics**: eleven of Poly Haven's CC0 fabric scans as cloth presets (`textiles`, `textiles-full`; `fabricTexturePresets`).
|
|
17
|
+
- **Material previews** are drawn on Tonio's material test ball, on grey (a cube until it loads).
|
|
18
|
+
- **Export a rigged body as a GLB** from the rig tool and the character builder (joint names, rest pose, height; the model's materials and springs).
|
|
19
|
+
- **Character builder**: Hold uses Tonio's textured weapons with a manipulator on the grip; clips come from a smaller builder pack (`UAL_builder.glb`); `playback3d` (play, scrub, speed) in Motion; all four AI characters open on hand-placed rigs.
|
|
20
|
+
- **Rig tool**: spread fingers, and hand modes (full, mitten, none); opened from the builder it shows the body it already wears.
|
|
21
|
+
- **Biped melee**: `holdingWeapon` stands on guard in Sword_Idle and the right trigger swings (Sword_Attack). The biped playground carries Tonio's weapons.
|
|
22
|
+
- **Material inputs that take a picture** are a heading and a row: choose a picture, clear it, a flat colour or grey instead (`colorPicker` icon), and a swatch of what it is now. `colorPicker3d` and `color3d` take `grey: true` (a black-to-white ramp and a ladder of greys).
|
|
23
|
+
- **`slider3d` `notches`**: a press beside the handle steps to the next notch that way; dragging stays continuous. A material's `tile` is now **scale textures**, 1/32 to 4 on a log scale, notched at 1/n and whole numbers (`textureScaleNotches`), where pictures repeat whole.
|
|
24
|
+
- **The tailor has undo and redo** on a bar pinned to the top of its panel (⌘Z / ⇧⌘Z in the builder while it is open), with cancel and done unless it is `persistent`.
|
|
25
|
+
- **Grips per class of item** (`hold-grip`: `holdGrip`, `holdClassOf`, `HOLD_CLASSES`): pistols, rifles, heavy weapons, one- and two-handed blades, bows, shields. The character builder keeps an adjusted grip per class (placing one sword places every one-handed blade; per-item grips saved before are read as their class's), and the biped playground holds by class.
|
|
26
|
+
- **The character builder's tailor is always on the bar** (scissors): pick a slot and a garment, and one you cut opens on its outline to edit, or start a new one; no done or cancel, it keeps the garment when you switch or close, and undo covers the edits. Export, import and forget moved into it; the Tailor tab is gone. `mountTailorTool` takes `panel`, `persistent` and `rows`; characters take `hideSlot` (one slot's garment off for a moment).
|
|
27
|
+
- **Character builder clothes**: each slot is one row, the garment and its material swatch beside it; the "edit" picker is gone. `materialPicker3d` takes `name` (a title with no caption).
|
|
28
|
+
- **Tailor drape**: edits no longer lock the page (debounced, sliced, interruptible: `drapeGarmentAsync`, `runSliced`, `drapeSteps`, `remeshSteps`); cloth goes over arms, shoulders and hips; anchored points are drawn in the new `--w3d-anchored` colour.
|
|
29
|
+
|
|
30
|
+
## Changed
|
|
31
|
+
|
|
32
|
+
- **Stroked-and-filled icons fill with `--w3d-icon-fill`** (a mid blue) instead of the button colour behind them. Pass `knockout` to `iconGlyph`, or set `--tosi-icon-knockout`, for the old look.
|
|
33
|
+
- The rig tool's hosted "start over" is an icon beside undo and redo.
|
|
34
|
+
- Material inputs are labelled **diffuse** (albedo), **normal map** (was bumps) and **colorize** (a cloth's recolour); the recipe keys are unchanged.
|
|
35
|
+
- A material's `tile` input's range is now 1/32 to 4 (was 0.02 to 4), so a smaller saved value is clamped.
|
|
36
|
+
- Cloth material previews show a colour the recipe names wholly (the preview has no texture for a recolour to keep).
|
|
37
|
+
- The tailor's "export glTF" button reads "export GLB".
|
|
38
|
+
|
|
39
|
+
## Fixed
|
|
40
|
+
|
|
41
|
+
- Arrow keys and Space no longer scroll the page while you play a demo.
|
|
42
|
+
- Tailor, cut from the skin: tidy, smoothed cut edges (no spikes or notches along a neckline).
|
|
43
|
+
- Drape: edges well clear of the body are no longer pinned to it (rigid hems).
|
|
44
|
+
- A held item's grip is measured on fresh world matrices (the pistol no longer circles the hand metres away); the launcher reads its `_grip` the same way.
|
|
45
|
+
- Auto-rig: glove bumps are not read as fingers, and a knotted thumb is placed by proportion.
|
|
46
|
+
- The rig tool casts shadows when hosted, and done on a body from a file no longer leaves it invisible.
|
|
47
|
+
- Undoing a placed grip in the character builder moves the held item back (the numbers were restored, the item was not).
|
|
48
|
+
- A stroked-and-filled icon's part drawn with `stroke:none` stays unstroked (tosijs-ui#251 worked round by `bin/icon-no-stroke.ts`).
|
package/dist/asset-url.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export declare function getAssetBase(): string;
|
|
|
29
29
|
* he had. Three wrong diagnoses before someone looked at the actual bytes.
|
|
30
30
|
*
|
|
31
31
|
* So pass a version whenever you depend on content that has been republished:
|
|
32
|
-
* `assetUrl('quaternius/UAL1_core.glb',
|
|
32
|
+
* `assetUrl('quaternius/UAL1_core.glb', 3)`. It changes the URL, which is the
|
|
33
33
|
* only thing an immutable cache respects.
|
|
34
34
|
*/
|
|
35
35
|
export declare function assetUrl(path: string, version?: string | number): string;
|
package/dist/asset-url.js
CHANGED
|
@@ -52,7 +52,7 @@ export function getAssetBase() {
|
|
|
52
52
|
* he had. Three wrong diagnoses before someone looked at the actual bytes.
|
|
53
53
|
*
|
|
54
54
|
* So pass a version whenever you depend on content that has been republished:
|
|
55
|
-
* `assetUrl('quaternius/UAL1_core.glb',
|
|
55
|
+
* `assetUrl('quaternius/UAL1_core.glb', 3)`. It changes the URL, which is the
|
|
56
56
|
* only thing an immutable cache respects.
|
|
57
57
|
*/
|
|
58
58
|
export function assetUrl(path, version) {
|
package/dist/b3d-biped.d.ts
CHANGED
|
@@ -22,28 +22,6 @@ export declare class AnimState {
|
|
|
22
22
|
constructor(spec: AnimStateSpec);
|
|
23
23
|
static buildList(...specs: AnimStateSpec[]): AnimState[];
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* **Animation states for a Quaternius UAL rig** (the Universal Animation
|
|
27
|
-
* Library, on `cdn.tosijs.net/quaternius/`).
|
|
28
|
-
*
|
|
29
|
-
* The biped drives states by NAME — `walk`, `run`, `sneak` — and a rig supplies
|
|
30
|
-
* whatever its animator called them. This is the translation for UAL, so
|
|
31
|
-
* adopting that library is one line:
|
|
32
|
-
*
|
|
33
|
-
* ```js
|
|
34
|
-
* b3dBiped({
|
|
35
|
-
* url: assetUrl('quaternius/UAL1_core.glb', 2),
|
|
36
|
-
* animationStates: ualAnimationStates(),
|
|
37
|
-
* })
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* Two things it buys beyond names. `walkBackwards` becomes a real
|
|
41
|
-
* `Jog_Bwd_Loop` rather than the walk cycle played in reverse, and `sneak` gets
|
|
42
|
-
* a crouch that holds at rest — both were fakes against the stock rig.
|
|
43
|
-
*
|
|
44
|
-
* Pass `extra` to add or override entries; a later entry with the same `name`
|
|
45
|
-
* wins, so a project can retarget one state without restating the rest.
|
|
46
|
-
*/
|
|
47
25
|
export declare function ualAnimationStates(extra?: AnimStateSpec[]): AnimState[];
|
|
48
26
|
export declare class B3dBiped extends B3dControllable {
|
|
49
27
|
static preferredTagName: string;
|
|
@@ -321,6 +299,16 @@ export declare class B3dBiped extends B3dControllable {
|
|
|
321
299
|
* Unset, the button toggles `gunplay` as before.
|
|
322
300
|
*/
|
|
323
301
|
whenWeapon: ((up: boolean) => void) | null;
|
|
302
|
+
/**
|
|
303
|
+
* A MELEE weapon is in hand (a sword): it stays visible with gunplay off
|
|
304
|
+
* (lowered weapons are otherwise hidden, see `_showWeapons`), standing still
|
|
305
|
+
* is `meleeIdle` (UAL's `Sword_Idle`), and the right trigger swings
|
|
306
|
+
* (`meleeAttack`, `Sword_Attack`, played through) instead of sprinting.
|
|
307
|
+
* JS only; the game sets it when what is in hand changes.
|
|
308
|
+
*/
|
|
309
|
+
get holdingWeapon(): boolean;
|
|
310
|
+
set holdingWeapon(on: boolean);
|
|
311
|
+
private _holdingWeapon;
|
|
324
312
|
/**
|
|
325
313
|
* Put the weapon up or down.
|
|
326
314
|
*
|
|
@@ -673,6 +661,15 @@ export declare class B3dBiped extends B3dControllable {
|
|
|
673
661
|
private _blendStep;
|
|
674
662
|
private _ease;
|
|
675
663
|
private _paceBlends;
|
|
664
|
+
/**
|
|
665
|
+
* The melee version of a state: a swing in progress takes the whole body
|
|
666
|
+
* while on the ground (not mid-jump, swimming or climbing), and standing
|
|
667
|
+
* still is on guard. A rig without the clips keeps its own states.
|
|
668
|
+
*/
|
|
669
|
+
private _meleeState;
|
|
670
|
+
/** Seconds left of the swing playing now. */
|
|
671
|
+
private _attackFor;
|
|
672
|
+
private _swing;
|
|
676
673
|
setAnimationState(name: string, speed?: number): void;
|
|
677
674
|
getCameraTarget(): BABYLON.Node | null;
|
|
678
675
|
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":"AAoTA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EACL,OAAO,EAKR,MAAM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AAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAoB1C,6CAA6C;IAC7C,OAAO,CAAC,QAAQ,EAAE,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;YAmC7B,cAAc;YAYd,cAAc;IAkI5B,OAAO,CAAC,WAAW;IAkFnB,YAAY;IAyCZ,MAAM;CA6BP;AAED,eAAO,MAAM,QAAQ,2CAA4B,CAAA"}
|
package/dist/b3d-biped.js
CHANGED
|
@@ -82,7 +82,7 @@ const gun = b3dLauncher({
|
|
|
82
82
|
// on a figure half the intended size.
|
|
83
83
|
const hero = b3dBiped(
|
|
84
84
|
{
|
|
85
|
-
url: assetUrl('quaternius/UAL1_core.glb',
|
|
85
|
+
url: assetUrl('quaternius/UAL1_core.glb', 3),
|
|
86
86
|
animationStates: ualAnimationStates(),
|
|
87
87
|
player: true, cameraType: 'follow', aiming: 'on', aimFreeYaw: 45,
|
|
88
88
|
},
|
|
@@ -353,7 +353,7 @@ export class AnimState {
|
|
|
353
353
|
*
|
|
354
354
|
* ```js
|
|
355
355
|
* b3dBiped({
|
|
356
|
-
* url: assetUrl('quaternius/UAL1_core.glb',
|
|
356
|
+
* url: assetUrl('quaternius/UAL1_core.glb', 3),
|
|
357
357
|
* animationStates: ualAnimationStates(),
|
|
358
358
|
* })
|
|
359
359
|
* ```
|
|
@@ -365,6 +365,20 @@ export class AnimState {
|
|
|
365
365
|
* Pass `extra` to add or override entries; a later entry with the same `name`
|
|
366
366
|
* wins, so a project can retarget one state without restating the rest.
|
|
367
367
|
*/
|
|
368
|
+
/** The states a melee swing may take over: on the ground, not in the air or water. */
|
|
369
|
+
const MELEE_GROUND = new Set([
|
|
370
|
+
'idle',
|
|
371
|
+
'walk',
|
|
372
|
+
'run',
|
|
373
|
+
'sprint',
|
|
374
|
+
'walkBackwards',
|
|
375
|
+
'strafeLeft',
|
|
376
|
+
'strafeRight',
|
|
377
|
+
'sneak',
|
|
378
|
+
'sneakIdle',
|
|
379
|
+
'sneakLeft',
|
|
380
|
+
'sneakRight',
|
|
381
|
+
]);
|
|
368
382
|
export function ualAnimationStates(extra = []) {
|
|
369
383
|
const base = [
|
|
370
384
|
{ name: 'idle', animation: 'Idle_Loop', loop: true },
|
|
@@ -433,6 +447,10 @@ export function ualAnimationStates(extra = []) {
|
|
|
433
447
|
{ name: 'aimDown', animation: 'Pistol_Aim_Down', loop: true },
|
|
434
448
|
{ name: 'shoot', animation: 'Pistol_Shoot', loop: false },
|
|
435
449
|
{ name: 'reload', animation: 'Pistol_Reload', loop: false },
|
|
450
|
+
// MELEE, with a weapon held but not raised (see `holdingWeapon`): standing
|
|
451
|
+
// still on guard, and one swing per pull of the trigger.
|
|
452
|
+
{ name: 'meleeIdle', animation: 'Sword_Idle', loop: true },
|
|
453
|
+
{ name: 'meleeAttack', animation: 'Sword_Attack', loop: false },
|
|
436
454
|
];
|
|
437
455
|
const byName = new Map();
|
|
438
456
|
for (const spec of [...base, ...extra]) {
|
|
@@ -833,6 +851,21 @@ export class B3dBiped extends B3dControllable {
|
|
|
833
851
|
* Unset, the button toggles `gunplay` as before.
|
|
834
852
|
*/
|
|
835
853
|
whenWeapon = null;
|
|
854
|
+
/**
|
|
855
|
+
* A MELEE weapon is in hand (a sword): it stays visible with gunplay off
|
|
856
|
+
* (lowered weapons are otherwise hidden, see `_showWeapons`), standing still
|
|
857
|
+
* is `meleeIdle` (UAL's `Sword_Idle`), and the right trigger swings
|
|
858
|
+
* (`meleeAttack`, `Sword_Attack`, played through) instead of sprinting.
|
|
859
|
+
* JS only; the game sets it when what is in hand changes.
|
|
860
|
+
*/
|
|
861
|
+
get holdingWeapon() {
|
|
862
|
+
return this._holdingWeapon;
|
|
863
|
+
}
|
|
864
|
+
set holdingWeapon(on) {
|
|
865
|
+
this._holdingWeapon = on;
|
|
866
|
+
this._showWeapons(this.gunplay);
|
|
867
|
+
}
|
|
868
|
+
_holdingWeapon = false;
|
|
836
869
|
/**
|
|
837
870
|
* Put the weapon up or down.
|
|
838
871
|
*
|
|
@@ -868,8 +901,9 @@ export class B3dBiped extends B3dControllable {
|
|
|
868
901
|
* walk — and that is already on the list.
|
|
869
902
|
*/
|
|
870
903
|
_showWeapons(visible) {
|
|
904
|
+
const shown = visible || this._holdingWeapon;
|
|
871
905
|
for (const w of this._weapons())
|
|
872
|
-
w.mesh?.setEnabled(
|
|
906
|
+
w.mesh?.setEnabled(shown);
|
|
873
907
|
}
|
|
874
908
|
/**
|
|
875
909
|
* POINT THE WEAPON WHERE THE SHOT GOES.
|
|
@@ -938,7 +972,9 @@ export class B3dBiped extends B3dControllable {
|
|
|
938
972
|
* (TS2611). An arrow field binds `this` and reads the mode live, which is all
|
|
939
973
|
* the getter was for.
|
|
940
974
|
*/
|
|
941
|
-
inputMapping = (pad, dt) =>
|
|
975
|
+
inputMapping = (pad, dt) =>
|
|
976
|
+
// A melee weapon takes the trigger too: it swings rather than sprints.
|
|
977
|
+
bipedMapping(pad, dt, this.gunplay || this._holdingWeapon);
|
|
942
978
|
inputLabels = bipedMappingDescriptor.labels;
|
|
943
979
|
/**
|
|
944
980
|
* Aiming right now.
|
|
@@ -1630,6 +1666,8 @@ export class B3dBiped extends B3dControllable {
|
|
|
1630
1666
|
* layer instead, because a walk cycle is still a walk cycle.
|
|
1631
1667
|
*/
|
|
1632
1668
|
_gunplayState(name) {
|
|
1669
|
+
if (!this.gunplay && this._holdingWeapon)
|
|
1670
|
+
return this._meleeState(name);
|
|
1633
1671
|
if (!this.gunplay)
|
|
1634
1672
|
return name;
|
|
1635
1673
|
if (name !== 'idle')
|
|
@@ -1765,8 +1803,33 @@ export class B3dBiped extends B3dControllable {
|
|
|
1765
1803
|
for (const group of this._eased)
|
|
1766
1804
|
group.blendingSpeed = step;
|
|
1767
1805
|
}
|
|
1806
|
+
/**
|
|
1807
|
+
* The melee version of a state: a swing in progress takes the whole body
|
|
1808
|
+
* while on the ground (not mid-jump, swimming or climbing), and standing
|
|
1809
|
+
* still is on guard. A rig without the clips keeps its own states.
|
|
1810
|
+
*/
|
|
1811
|
+
_meleeState(name) {
|
|
1812
|
+
if (this._attackFor > 0 && MELEE_GROUND.has(name))
|
|
1813
|
+
return 'meleeAttack';
|
|
1814
|
+
if (name === 'idle' && this._hasClip('Sword_Idle'))
|
|
1815
|
+
return 'meleeIdle';
|
|
1816
|
+
return name;
|
|
1817
|
+
}
|
|
1818
|
+
/** Seconds left of the swing playing now. */
|
|
1819
|
+
_attackFor = 0;
|
|
1820
|
+
_swing() {
|
|
1821
|
+
if (!this._hasClip('Sword_Attack')) {
|
|
1822
|
+
this._warnOnce(`b3d-biped: melee attack, but ${this.url || 'this rig'} has no ` +
|
|
1823
|
+
`Sword_Attack clip. If it should, the asset is probably cached.`);
|
|
1824
|
+
return;
|
|
1825
|
+
}
|
|
1826
|
+
this._attackFor = this._clipSeconds('Sword_Attack') || 1;
|
|
1827
|
+
}
|
|
1768
1828
|
setAnimationState(name, speed = 1) {
|
|
1769
1829
|
name = this._gunplayState(name);
|
|
1830
|
+
// A swing and the guard play at their own speed, not the gait's.
|
|
1831
|
+
if (name === 'meleeAttack' || name === 'meleeIdle')
|
|
1832
|
+
speed = 1;
|
|
1770
1833
|
if (name == null) {
|
|
1771
1834
|
throw new Error('setAnimationState failed, no animation name specified.');
|
|
1772
1835
|
}
|
|
@@ -2340,6 +2403,13 @@ export class B3dBiped extends B3dControllable {
|
|
|
2340
2403
|
// holstered character who fires anyway is worse than one who cannot.
|
|
2341
2404
|
if (this.gunplay && (input.shoot ?? 0) > 0.5)
|
|
2342
2405
|
this._fireWeapons();
|
|
2406
|
+
// A melee weapon swings, once per swing: held, it swings again after.
|
|
2407
|
+
this._attackFor = Math.max(0, this._attackFor - dt);
|
|
2408
|
+
if (!this.gunplay &&
|
|
2409
|
+
this._holdingWeapon &&
|
|
2410
|
+
this._attackFor === 0 &&
|
|
2411
|
+
(input.shoot ?? 0) > 0.5)
|
|
2412
|
+
this._swing();
|
|
2343
2413
|
// After the shot, so the ring sits where THIS frame's aim points rather
|
|
2344
2414
|
// than lagging it by one.
|
|
2345
2415
|
if (this.owner != null)
|
|
@@ -3373,6 +3443,10 @@ export class B3dBiped extends B3dControllable {
|
|
|
3373
3443
|
if (changes.length)
|
|
3374
3444
|
console.warn('<tosi-b3d-biped>: the character file, read with changes', changes);
|
|
3375
3445
|
const settings = c.settings;
|
|
3446
|
+
// The pictures its materials use (a print chosen from disk), by key.
|
|
3447
|
+
const { registerPicture } = await import('./material-pictures.js');
|
|
3448
|
+
for (const [key, b64] of Object.entries(c.pictures ?? {}))
|
|
3449
|
+
registerPicture(key, b64);
|
|
3376
3450
|
// A mesh body comes from the page's sources, or from where the file says
|
|
3377
3451
|
// (a URL, or the mesh itself inside the file).
|
|
3378
3452
|
const sources = { ...CHARACTER_SOURCES };
|
|
@@ -3410,7 +3484,7 @@ export class B3dBiped extends B3dControllable {
|
|
|
3410
3484
|
return;
|
|
3411
3485
|
}
|
|
3412
3486
|
// The clips the states name, from the library, retargeted and named as they were.
|
|
3413
|
-
const library = await BABYLON.LoadAssetContainerAsync(attrs.animations || assetUrl('quaternius/UAL1_core.glb',
|
|
3487
|
+
const library = await BABYLON.LoadAssetContainerAsync(attrs.animations || assetUrl('quaternius/UAL1_core.glb', 3), scene);
|
|
3414
3488
|
library.addAllToScene();
|
|
3415
3489
|
for (const g of library.animationGroups)
|
|
3416
3490
|
g.stop();
|