@origingame/engine 0.0.0-stage → 0.1.1
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/bin/og.mjs +25 -0
- package/dist/web/origin-engine.d.ts +1233 -0
- package/dist/web/origin-engine.js +8628 -0
- package/dist/web/origin-engine_bg.wasm +0 -0
- package/dist/web/origin-engine_bg.wasm.d.ts +366 -0
- package/dist/web-publish/origin-engine-lanes.js +8509 -0
- package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish/origin-engine.d.ts +1176 -0
- package/dist/web-publish/origin-engine.js +8313 -0
- package/dist/web-publish/origin-engine_bg.wasm +0 -0
- package/dist/web-publish/origin-engine_bg.wasm.d.ts +347 -0
- package/dist/web-publish/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
- package/dist/web-publish-2d/origin-engine-lanes.js +8509 -0
- package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine.d.ts +1176 -0
- package/dist/web-publish-2d/origin-engine.js +8313 -0
- package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +347 -0
- package/dist/web-publish-2d/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
- package/knowledge/README.md +31 -0
- package/knowledge/knowledge.json +13 -0
- package/knowledge/looks/catalogue.json +1871 -0
- package/knowledge/package.json +33 -0
- package/knowledge/rules/platform.json +329 -0
- package/knowledge/scaffold/README.md +27 -0
- package/knowledge/scaffold/distribution.json +48 -0
- package/knowledge/scaffold/origin-engine.json +19 -0
- package/knowledge/scaffold/template/.origin/setup +14 -0
- package/knowledge/scaffold/template/LICENSES.md +23 -0
- package/knowledge/scaffold/template/README.md +37 -0
- package/knowledge/scaffold/template/assets/ai/guard.ogt +48 -0
- package/knowledge/scaffold/template/assets/audio/click.ogt +9 -0
- package/knowledge/scaffold/template/assets/fonts/NotoSansSC-Regular-subset.ttf.ogt +12 -0
- package/knowledge/scaffold/template/assets/fonts/OFL.txt +93 -0
- package/knowledge/scaffold/template/assets/looks/origin-game.ogt +12 -0
- package/knowledge/scaffold/template/assets/nav/yard.ogt +27 -0
- package/knowledge/scaffold/template/assets/scenes/main.ogt +34 -0
- package/knowledge/scaffold/template/assets/strings/en.ogt +14 -0
- package/knowledge/scaffold/template/assets/textures/stone_n.png.ogt +7 -0
- package/knowledge/scaffold/template/gitattributes +22 -0
- package/knowledge/scaffold/template/gitignore +8 -0
- package/knowledge/scaffold/template/package.json +18 -0
- package/knowledge/scaffold/template/project.ogt +25 -0
- package/knowledge/scaffold/template/src/main.ts +246 -0
- package/knowledge/scaffold/template/tests/guard.og.ts +67 -0
- package/knowledge/scaffold/template/tests/smoke.og.ts +43 -0
- package/knowledge/scaffold/template/tsconfig.json +17 -0
- package/knowledge/scripts/lib.ts +207 -0
- package/knowledge/scripts/mount.ts +210 -0
- package/knowledge/scripts/pack.ts +25 -0
- package/knowledge/scripts/scaffold.ts +72 -0
- package/knowledge/scripts/validate.ts +749 -0
- package/knowledge/skills/og-ai/SKILL.md +386 -0
- package/knowledge/skills/og-audio/SKILL.md +191 -0
- package/knowledge/skills/og-build/SKILL.md +330 -0
- package/knowledge/skills/og-core/SKILL.md +285 -0
- package/knowledge/skills/og-feel/SKILL.md +385 -0
- package/knowledge/skills/og-game/SKILL.md +1479 -0
- package/knowledge/skills/og-i18n/SKILL.md +220 -0
- package/knowledge/skills/og-platform-sdk/SKILL.md +199 -0
- package/knowledge/skills/og-taste/SKILL.md +537 -0
- package/knowledge/skills/og-ui/SKILL.md +444 -0
- package/knowledge/wiki/ai.md +627 -0
- package/knowledge/wiki/anim.md +1187 -0
- package/knowledge/wiki/atmosphere.md +636 -0
- package/knowledge/wiki/audio.md +732 -0
- package/knowledge/wiki/camera.md +711 -0
- package/knowledge/wiki/commands.md +357 -0
- package/knowledge/wiki/game.md +220 -0
- package/knowledge/wiki/i18n.md +213 -0
- package/knowledge/wiki/index.md +1027 -0
- package/knowledge/wiki/input.md +1714 -0
- package/knowledge/wiki/load.md +1280 -0
- package/knowledge/wiki/math.md +166 -0
- package/knowledge/wiki/nav.md +1154 -0
- package/knowledge/wiki/physics.md +3142 -0
- package/knowledge/wiki/platform.md +857 -0
- package/knowledge/wiki/probe.md +1692 -0
- package/knowledge/wiki/reflect.md +285 -0
- package/knowledge/wiki/render.md +3511 -0
- package/knowledge/wiki/rng.md +393 -0
- package/knowledge/wiki/stream.md +376 -0
- package/knowledge/wiki/system.md +197 -0
- package/knowledge/wiki/systems.md +43 -0
- package/knowledge/wiki/terrain.md +727 -0
- package/knowledge/wiki/tilemap.md +422 -0
- package/knowledge/wiki/time.md +150 -0
- package/knowledge/wiki/transform.md +230 -0
- package/knowledge/wiki/tween.md +580 -0
- package/knowledge/wiki/ui.md +8000 -0
- package/knowledge/wiki/world.md +909 -0
- package/package.json +68 -4
- package/schema/api.schema.json +29675 -0
- package/shell/README.md +22 -0
- package/shell/brand/README.md +23 -0
- package/shell/brand/icon-192.png +0 -0
- package/shell/brand/icon-512.png +0 -0
- package/shell/brand/mark-on-paper.svg +6 -0
- package/shell/brand/origin-mark.svg +5 -0
- package/shell/brand/origin-motion.css +251 -0
- package/shell/brand/tokens.css +20 -0
- package/shell/brand.ts +132 -0
- package/shell/page.ts +715 -0
- package/shell/platform.ts +203 -0
- package/shell/player.ts +238 -0
- package/shell/shell.css +185 -0
- package/shell/sw.ts +177 -0
- package/shell/transport.ts +515 -0
- package/shell/wire.ts +369 -0
- package/src/e6.ts +69 -0
- package/src/env.d.ts +100 -0
- package/src/generated/abi.ts +980 -0
- package/src/index.ts +193 -0
- package/src/node/audio.ts +86 -0
- package/src/node/build.ts +109 -0
- package/src/node/device.ts +981 -0
- package/src/node/doctor.ts +60 -0
- package/src/node/index.ts +102 -0
- package/src/node/platform.ts +24 -0
- package/src/node/playtest-run.ts +249 -0
- package/src/node/png.ts +130 -0
- package/src/node/polish.ts +976 -0
- package/src/node/run.ts +373 -0
- package/src/node/web-build.ts +808 -0
- package/src/p2.ts +35 -0
- package/src/platform-local.ts +211 -0
- package/src/playtest.ts +131 -0
- package/src/runtime.ts +1509 -0
- package/src/systems/cameras.ts +247 -0
- package/src/ui-kit/bind.ts +141 -0
- package/src/ui-kit/huds.ts +303 -0
- package/src/ui-kit/index.ts +36 -0
- package/src/ui-kit/menus.ts +187 -0
- package/src/ui-kit/settings.ts +131 -0
- package/src/ui-kit/store.ts +222 -0
- package/src/ui-kit/story.ts +89 -0
- package/src/ui-kit/util.ts +106 -0
- package/src/web/a11y.ts +429 -0
- package/src/web/audio-worklet.ts +193 -0
- package/src/web/audio.ts +307 -0
- package/src/web/basis.ts +239 -0
- package/src/web/gamepad.ts +123 -0
- package/src/web/host.ts +166 -0
- package/src/web/input.ts +237 -0
- package/src/web/lanes.ts +21 -0
- package/src/web/play.ts +20 -0
- package/src/web/rpc-ring.ts +110 -0
- package/src/web/settle.ts +122 -0
- package/src/web/shell.ts +643 -0
- package/src/web/text-input.ts +248 -0
- package/src/web/worker.ts +1002 -0
- package/types/bindings.json +13654 -0
- package/types/index.d.ts +20090 -0
- package/vendor/basis/LICENSE +201 -0
- package/vendor/basis/NOTICE +15 -0
- package/vendor/basis/README.md +18 -0
- package/vendor/basis/basis_transcoder.js +19 -0
- package/vendor/basis/basis_transcoder.wasm +0 -0
- package/README.md +0 -3
|
@@ -0,0 +1,1187 @@
|
|
|
1
|
+
<!-- Generated from crates/og-api/api.ogt by `og api gen`. Do not edit: `og api check` fails on any difference; change api.ogt and regenerate. -->
|
|
2
|
+
|
|
3
|
+
# The `anim` module
|
|
4
|
+
|
|
5
|
+
Skeletal animation over og-anim: glTF skins and clips (cooked into the `<model>#anim` blob, loaded with og.load.animation), blend-tree graphs with layered state machines, root motion, two-bone and FABRIK IK and blendshapes, evaluated by the engine's og.anim system after the game's systems and before physics.
|
|
6
|
+
|
|
7
|
+
Game code owns the components and sets players, graph parameters and IK targets; og.anim writes the pose (kept as world state in the `og.anim` state block, so snapshots, restore and the world hash cover it), the joint palette, root motion into og.Transform and the fields marked written. Asset handles are what og.load.animation and og.anim.graph answer; 0 is none.
|
|
8
|
+
|
|
9
|
+
Clips bind to a skeleton's nodes by name, so a clip of one rig plays on another with the same node names; a rig with other names or proportions plays it retargeted (og.anim.retarget at run time, or a model's `animation { library }` import setting at cook time). Assets are not world state: a hot reload registers them again.
|
|
10
|
+
|
|
11
|
+
- **TypeScript**: functions are the namespace `og.anim`; components, resources and events are tokens on `og`.
|
|
12
|
+
- **Publish builds**: kept (members may override).
|
|
13
|
+
- **Skill**: `og-game`, which teaches the module (how much of it to use, and how to prove it).
|
|
14
|
+
- **Index**: [every module and name](index.md).
|
|
15
|
+
|
|
16
|
+
```ogt
|
|
17
|
+
module anim {
|
|
18
|
+
# declarations follow, each quoted below
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
<sub>`api.ogt` line 5606</sub>
|
|
22
|
+
|
|
23
|
+
## Contents
|
|
24
|
+
|
|
25
|
+
| Name | Kind | Summary |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| [`SkeletonAsset`](#type-SkeletonAsset) | handle | A rig: a glTF's nodes in topological order with their rest transforms, and its skins (joints and inverse bind matrices). |
|
|
28
|
+
| [`ClipAsset`](#type-ClipAsset) | handle | An animation clip, resampled at the cook's rate, with its markers. |
|
|
29
|
+
| [`GraphAsset`](#type-GraphAsset) | handle | A blend-tree graph (`type animgraph`) whose clip references were resolved to clip handles. |
|
|
30
|
+
| [`SkeletonAsset()`](#column-SkeletonAsset) | column kind | A SkeletonAsset handle field. |
|
|
31
|
+
| [`ClipAsset()`](#column-ClipAsset) | column kind | A ClipAsset handle field. |
|
|
32
|
+
| [`GraphAsset()`](#column-GraphAsset) | column kind | A GraphAsset handle field. |
|
|
33
|
+
| [`RootMotion`](#type-RootMotion) | enum | What the root joint's motion does to the entity. |
|
|
34
|
+
| [`RootMotion()`](#column-RootMotion) | column kind | A RootMotion field: the variant's index. |
|
|
35
|
+
| [`BlendshapeSource`](#type-BlendshapeSource) | enum | Who decides blendshape weights. |
|
|
36
|
+
| [`BlendshapeSource()`](#column-BlendshapeSource) | column kind | A BlendshapeSource field: the variant's index. |
|
|
37
|
+
| [`IkSolver`](#type-IkSolver) | enum | How an IK chain is solved. |
|
|
38
|
+
| [`IkSolver()`](#column-IkSolver) | column kind | An IkSolver field: the variant's index. |
|
|
39
|
+
| [`IkSpace`](#type-IkSpace) | enum | What an IK chain's target and pole are relative to. |
|
|
40
|
+
| [`IkSpace()`](#column-IkSpace) | column kind | An IkSpace field: the variant's index. |
|
|
41
|
+
| [`og.Skeleton`](#record-Skeleton) | component | A posed skeleton: the entity is drawn skinned by the joint palette og.anim writes each tick. The pose itself (every node's local transform) is world state kept by the `og.anim` state block. |
|
|
42
|
+
| [`og.AnimationPlayer`](#record-AnimationPlayer) | component | Plays one clip on a skeleton. Alone it poses the skeleton from its rest pose; with an og.AnimationGraph it plays over the graph's result with `weight`. Changing `clip` cross-fades from the previous one over `fade`; a clip change starts the new clip at 0 (or at `time` if the game wrote it in the same tick). |
|
|
43
|
+
| [`og.AnimationGraph`](#record-AnimationGraph) | component | Runs a blend-tree graph (og.anim.graph) on a skeleton: its layers' state machines pick motions by the parameters p0...p7, which the graph names in `param` order (`param speed` is p0, the next `param` is p1, ...). |
|
|
44
|
+
| [`og.Blendshapes`](#record-Blendshapes) | component | Morph-target weights of the skeleton entity's mesh, in the order of the glTF mesh's targets. With `source` clips the playing clips' weight channels write them; with `component` game code does. |
|
|
45
|
+
| [`og.IkChain`](#record-IkChain) | component | An inverse-kinematics constraint on a skeleton, applied after its clips and graph: the chain of `bones` bones ending at joint `tip` turns so the tip reaches `target`. Put it on its own entity (a skeleton can have many chains); chains apply in query order. |
|
|
46
|
+
| [`og.AnimationEvent`](#record-AnimationEvent) | event | A named marker of a clip that playback passed in the last tick (read in the tick after it fired, like every event). Cross-fades and blends fire every contributing clip's markers. |
|
|
47
|
+
| [`ClipInfo`](#type-ClipInfo) | struct | One clip of a loaded animation. |
|
|
48
|
+
| [`Animation`](#type-Animation) | struct | What og.load.animation registered from a model's `#anim` blob. |
|
|
49
|
+
| [`GraphDesc`](#type-GraphDesc) | desc struct | A blend-tree graph to register. |
|
|
50
|
+
| [`og.anim.graph`](#fn-graph) | function | Register a blend-tree graph for AnimationGraph.asset. Its `clip` lines are resolved by name against `clips`. |
|
|
51
|
+
| [`Rig`](#type-Rig) | handle | A humanoid map from og.load.rig (a cooked `.ogt` of `type rig`): the naming scheme a skeleton's node names follow and the standard bones it names outright. |
|
|
52
|
+
| [`HumanBone`](#type-HumanBone) | struct | One standard humanoid bone of a skeleton. |
|
|
53
|
+
| [`Humanoid`](#type-Humanoid) | struct | Which node of a skeleton is each standard humanoid bone (what retargeting maps). |
|
|
54
|
+
| [`HumanoidDesc`](#type-HumanoidDesc) | desc struct | A skeleton and, optionally, the rig that says how its bones are named. |
|
|
55
|
+
| [`og.anim.humanoid`](#fn-humanoid) | function | The standard humanoid bones of a skeleton, as retargeting sees them: to check a rig before retargeting onto it. |
|
|
56
|
+
| [`RetargetDesc`](#type-RetargetDesc) | desc struct | A clip made for one skeleton, to play on another (other proportions, rest pose or bone names). |
|
|
57
|
+
| [`og.anim.retarget`](#fn-retarget) | function | A new clip for `target` from a clip of `source`: each animated humanoid bone turns as the source's does from its rest pose (after a rest correction, so a T-pose drives an A-pose and other bone frames agree), the target keeps its bone lengths, the hips travel the source's distance scaled by the leg ratio (root motion kept, hip height scaled), and with footIk the feet land where the source's do, scaled. Same name, duration and markers. The cook does the same for a model's `animation { library }` import setting; this is for clips chosen at run time. |
|
|
58
|
+
| [`FlipbookSheet`](#type-FlipbookSheet) | handle | A sprite sheet's frames and clips (a cooked `.ogt` of `type flipbook`), from og.load.flipbook. |
|
|
59
|
+
| [`FlipbookSheet()`](#column-FlipbookSheet) | column kind | A FlipbookSheet handle field. |
|
|
60
|
+
| [`FlipMode`](#type-FlipMode) | enum | How a flipbook clip runs past its last frame. |
|
|
61
|
+
| [`og.Flipbook`](#record-Flipbook) | component | Plays a clip of a flipbook sheet on the entity's og.Sprite: extraction draws the sprite with the sheet's texture and the current frame's region and pivot, or, for an `array true` sheet, the frame's layer of its texture array whole (the sprite keeps its size, colour, flips and layer). Played by the engine's og.flipbook system by scaled time (Time.scaledDt: slow motion, hit stop), after the game's systems. |
|
|
62
|
+
| [`og.FlipbookEvent`](#record-FlipbookEvent) | event | A flipbook entered a frame its clip names in an `event` line (`event 2 "step"`): footsteps, the frame a hit lands, a pickup's sparkle. Read in the tick after, like every event; a clip started at 0 fires its first frame's events. |
|
|
63
|
+
| [`FlipbookClipInfo`](#type-FlipbookClipInfo) | struct | One clip of a loaded flipbook sheet. |
|
|
64
|
+
| [`FlipbookInfo`](#type-FlipbookInfo) | struct | What og.load.flipbook registered. |
|
|
65
|
+
| [`og.anim.clip`](#fn-clip) | function | The index of a flipbook clip by name, for Flipbook.clip: `og.anim.clip(hero, "walk_down")`. -1 when the sheet has no such clip. |
|
|
66
|
+
| [`og.anim.clip`](#fn-clip) | function | A loaded model's clip by name, for AnimationPlayer.clip: `og.anim.clip(og.load.animation(world, "models/slime.glb").value, "chase")`, the same lookup as a flipbook's (Animation.clips by ClipInfo.name). A skinned glTF's clips are its animations' names; an animated `.vox`'s are `frames` or its `voxClip` names. 0 (plays nothing) when the model has no such clip. |
|
|
67
|
+
|
|
68
|
+
## Functions
|
|
69
|
+
|
|
70
|
+
<a id="fn-graph"></a>
|
|
71
|
+
|
|
72
|
+
### `og.anim.graph`
|
|
73
|
+
|
|
74
|
+
Register a blend-tree graph for AnimationGraph.asset. Its `clip` lines are resolved by name against `clips`.
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
og.anim.graph(world: World, desc?: GraphDesc): Result<GraphAsset>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
| Parameter | Type | Optional | Doc |
|
|
81
|
+
|---|---|---|---|
|
|
82
|
+
| `world` | `World` | no | The world whose animation owns the graph. |
|
|
83
|
+
| `desc` | `GraphDesc` | yes | The text and the clips it may name. |
|
|
84
|
+
|
|
85
|
+
**Returns** `Result<GraphAsset>`: Refused for a parse error (the reason names the line), a clip name `clips` lacks, or an invalid graph.
|
|
86
|
+
|
|
87
|
+
Binding symbol `og_anim_graph` · publish builds: kept
|
|
88
|
+
|
|
89
|
+
```ogt
|
|
90
|
+
fn graph {
|
|
91
|
+
doc "Register a blend-tree graph for AnimationGraph.asset. Its `clip` lines are resolved by name against `clips`."
|
|
92
|
+
param world World "The world whose animation owns the graph."
|
|
93
|
+
param desc GraphDesc "The text and the clips it may name."
|
|
94
|
+
returns Result.GraphAsset "Refused for a parse error (the reason names the line), a clip name `clips` lacks, or an invalid graph."
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
<sub>`api.ogt` line 5921</sub>
|
|
99
|
+
|
|
100
|
+
<a id="fn-humanoid"></a>
|
|
101
|
+
|
|
102
|
+
### `og.anim.humanoid`
|
|
103
|
+
|
|
104
|
+
The standard humanoid bones of a skeleton, as retargeting sees them: to check a rig before retargeting onto it.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
og.anim.humanoid(world: World, desc?: HumanoidDesc): Result<Humanoid>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
| Parameter | Type | Optional | Doc |
|
|
111
|
+
|---|---|---|---|
|
|
112
|
+
| `world` | `World` | no | The world whose animation owns the skeleton. |
|
|
113
|
+
| `desc` | `HumanoidDesc` | yes | The skeleton and its rig. |
|
|
114
|
+
|
|
115
|
+
**Returns** `Result<Humanoid>`: Refused for an unregistered skeleton or rig, or a rig naming a node the skeleton lacks.
|
|
116
|
+
|
|
117
|
+
Binding symbol `og_anim_humanoid` · publish builds: kept
|
|
118
|
+
|
|
119
|
+
```ogt
|
|
120
|
+
fn humanoid {
|
|
121
|
+
doc "The standard humanoid bones of a skeleton, as retargeting sees them: to check a rig before retargeting onto it."
|
|
122
|
+
param world World "The world whose animation owns the skeleton."
|
|
123
|
+
param desc HumanoidDesc "The skeleton and its rig."
|
|
124
|
+
returns Result.Humanoid "Refused for an unregistered skeleton or rig, or a rig naming a node the skeleton lacks."
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
<sub>`api.ogt` line 5949</sub>
|
|
129
|
+
|
|
130
|
+
<a id="fn-retarget"></a>
|
|
131
|
+
|
|
132
|
+
### `og.anim.retarget`
|
|
133
|
+
|
|
134
|
+
A new clip for `target` from a clip of `source`: each animated humanoid bone turns as the source's does from its rest pose (after a rest correction, so a T-pose drives an A-pose and other bone frames agree), the target keeps its bone lengths, the hips travel the source's distance scaled by the leg ratio (root motion kept, hip height scaled), and with footIk the feet land where the source's do, scaled. Same name, duration and markers. The cook does the same for a model's `animation { library }` import setting; this is for clips chosen at run time.
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
og.anim.retarget(world: World, desc?: RetargetDesc): Result<ClipInfo>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
| Parameter | Type | Optional | Doc |
|
|
141
|
+
|---|---|---|---|
|
|
142
|
+
| `world` | `World` | no | The world whose animation owns the skeletons and the clip. |
|
|
143
|
+
| `desc` | `RetargetDesc` | yes | The clip, the two skeletons and their rigs. |
|
|
144
|
+
|
|
145
|
+
**Returns** `Result<ClipInfo>`: The new clip (what AnimationPlayer.clip takes). Refused for an unregistered clip, skeleton or rig, a skeleton without recognisable hips (name them in a `type rig` file), or a rig naming a missing node.
|
|
146
|
+
|
|
147
|
+
Binding symbol `og_anim_retarget` · publish builds: kept
|
|
148
|
+
|
|
149
|
+
```ogt
|
|
150
|
+
fn retarget {
|
|
151
|
+
doc "A new clip for `target` from a clip of `source`: each animated humanoid bone turns as the source's does from its rest pose (after a rest correction, so a T-pose drives an A-pose and other bone frames agree), the target keeps its bone lengths, the hips travel the source's distance scaled by the leg ratio (root motion kept, hip height scaled), and with footIk the feet land where the source's do, scaled. Same name, duration and markers. The cook does the same for a model's `animation { library }` import setting; this is for clips chosen at run time."
|
|
152
|
+
param world World "The world whose animation owns the skeletons and the clip."
|
|
153
|
+
param desc RetargetDesc "The clip, the two skeletons and their rigs."
|
|
154
|
+
returns Result.ClipInfo "The new clip (what AnimationPlayer.clip takes). Refused for an unregistered clip, skeleton or rig, a skeleton without recognisable hips (name them in a `type rig` file), or a rig naming a missing node."
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
<sub>`api.ogt` line 5969</sub>
|
|
159
|
+
|
|
160
|
+
<a id="fn-clip"></a>
|
|
161
|
+
|
|
162
|
+
### `og.anim.clip`
|
|
163
|
+
|
|
164
|
+
The index of a flipbook clip by name, for Flipbook.clip: `og.anim.clip(hero, "walk_down")`. -1 when the sheet has no such clip.
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
og.anim.clip(info: FlipbookInfo, name: string): number
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
| Parameter | Type | Optional | Doc |
|
|
171
|
+
|---|---|---|---|
|
|
172
|
+
| `info` | `FlipbookInfo` | no | What og.load.flipbook answered. |
|
|
173
|
+
| `name` | `string` | no | The clip's name. |
|
|
174
|
+
|
|
175
|
+
**Returns** `number`.
|
|
176
|
+
|
|
177
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
178
|
+
|
|
179
|
+
```ogt
|
|
180
|
+
fn clip {
|
|
181
|
+
doc "The index of a flipbook clip by name, for Flipbook.clip: `og.anim.clip(hero, \"walk_down\")`. -1 when the sheet has no such clip."
|
|
182
|
+
host false
|
|
183
|
+
param info FlipbookInfo "What og.load.flipbook answered."
|
|
184
|
+
param name String "The clip's name."
|
|
185
|
+
returns i32
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
<sub>`api.ogt` line 6054</sub>
|
|
190
|
+
|
|
191
|
+
<a id="fn-clip-2"></a>
|
|
192
|
+
|
|
193
|
+
### `og.anim.clip`
|
|
194
|
+
|
|
195
|
+
A loaded model's clip by name, for AnimationPlayer.clip: `og.anim.clip(og.load.animation(world, "models/slime.glb").value, "chase")`, the same lookup as a flipbook's (Animation.clips by ClipInfo.name). A skinned glTF's clips are its animations' names; an animated `.vox`'s are `frames` or its `voxClip` names. 0 (plays nothing) when the model has no such clip.
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
og.anim.clip(info: Animation, name: string): ClipAsset
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
| Parameter | Type | Optional | Doc |
|
|
202
|
+
|---|---|---|---|
|
|
203
|
+
| `info` | `Animation` | no | What og.load.animation answered. |
|
|
204
|
+
| `name` | `string` | no | The clip's name. |
|
|
205
|
+
|
|
206
|
+
**Returns** `ClipAsset`.
|
|
207
|
+
|
|
208
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
209
|
+
|
|
210
|
+
```ogt
|
|
211
|
+
fn clip {
|
|
212
|
+
doc "A loaded model's clip by name, for AnimationPlayer.clip: `og.anim.clip(og.load.animation(world, \"models/slime.glb\").value, \"chase\")`, the same lookup as a flipbook's (Animation.clips by ClipInfo.name). A skinned glTF's clips are its animations' names; an animated `.vox`'s are `frames` or its `voxClip` names. 0 (plays nothing) when the model has no such clip."
|
|
213
|
+
host false
|
|
214
|
+
param info Animation "What og.load.animation answered."
|
|
215
|
+
param name String "The clip's name."
|
|
216
|
+
returns ClipAsset
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
<sub>`api.ogt` line 6062</sub>
|
|
221
|
+
|
|
222
|
+
## Components, resources and events
|
|
223
|
+
|
|
224
|
+
<a id="record-Skeleton"></a>
|
|
225
|
+
|
|
226
|
+
### `og.Skeleton` (component)
|
|
227
|
+
|
|
228
|
+
A posed skeleton: the entity is drawn skinned by the joint palette og.anim writes each tick. The pose itself (every node's local transform) is world state kept by the `og.anim` state block.
|
|
229
|
+
|
|
230
|
+
Token `og.Skeleton`, registered under the schema name `og.Skeleton`; its value type is `Skeleton`.
|
|
231
|
+
|
|
232
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
233
|
+
|---|---|---|---|---|---|---|
|
|
234
|
+
| `asset` | `SkeletonAsset` | `0` | — | — | — | The skeleton asset (og.load.animation's `skeleton`); 0 is none. |
|
|
235
|
+
| `skin` | `number` | `0` | ≥ 0 | — | — | Which of the asset's skins the joint palette is for (glTF skin index). |
|
|
236
|
+
| `rootMotion` | `RootMotion` | `"off"` | — | — | — | Root motion extraction: off (animate in place), planar (xz travel and yaw move og.Transform) or full. |
|
|
237
|
+
| `rootJoint` | `number` | `0` | ≥ 0 | — | — | The joint whose motion is extracted (an index into the skin's joints; 0 is its first joint, usually the hips). |
|
|
238
|
+
| `jointCount` | `number` | `0` | — | — | read only | Written: the number of joints in the palette (0 until the first tick). |
|
|
239
|
+
|
|
240
|
+
```ogt
|
|
241
|
+
component Skeleton {
|
|
242
|
+
doc "A posed skeleton: the entity is drawn skinned by the joint palette og.anim writes each tick. The pose itself (every node's local transform) is world state kept by the `og.anim` state block."
|
|
243
|
+
field asset SkeletonAsset "The skeleton asset (og.load.animation's `skeleton`); 0 is none."
|
|
244
|
+
field skin u32 "Which of the asset's skins the joint palette is for (glTF skin index)." {
|
|
245
|
+
min 0
|
|
246
|
+
}
|
|
247
|
+
field rootMotion RootMotion "Root motion extraction: off (animate in place), planar (xz travel and yaw move og.Transform) or full."
|
|
248
|
+
field rootJoint u32 "The joint whose motion is extracted (an index into the skin's joints; 0 is its first joint, usually the hips)." {
|
|
249
|
+
min 0
|
|
250
|
+
}
|
|
251
|
+
field jointCount u32 "Written: the number of joints in the palette (0 until the first tick)." {
|
|
252
|
+
readonly true
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
<sub>`api.ogt` line 5690</sub>
|
|
258
|
+
|
|
259
|
+
<a id="record-AnimationPlayer"></a>
|
|
260
|
+
|
|
261
|
+
### `og.AnimationPlayer` (component)
|
|
262
|
+
|
|
263
|
+
Plays one clip on a skeleton. Alone it poses the skeleton from its rest pose; with an og.AnimationGraph it plays over the graph's result with `weight`. Changing `clip` cross-fades from the previous one over `fade`; a clip change starts the new clip at 0 (or at `time` if the game wrote it in the same tick).
|
|
264
|
+
|
|
265
|
+
Token `og.AnimationPlayer`, registered under the schema name `og.AnimationPlayer`; its value type is `AnimationPlayer`.
|
|
266
|
+
|
|
267
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
268
|
+
|---|---|---|---|---|---|---|
|
|
269
|
+
| `clip` | `ClipAsset` | `0` | — | — | — | The clip asset; 0 plays nothing. |
|
|
270
|
+
| `time` | `number` | `0` | ≥ 0 | `s` | — | The playback position; written every tick, set it to seek (no markers fire across a seek). |
|
|
271
|
+
| `speed` | `number` | `1` | -10 … 10 | — | tunable | Playback rate (1 = as authored, negative plays backwards). |
|
|
272
|
+
| `loop` | `boolean` | `true` | — | — | — | Wrap at the end of the clip; otherwise hold the last frame and set `finished`. |
|
|
273
|
+
| `weight` | `number` | `1` | 0 … 1 | — | tunable | How much of the pose this player decides (0 = none, 1 = all). |
|
|
274
|
+
| `fade` | `number` | `0.2` | 0 … 10 | `s` | tunable | Cross-fade duration when `clip` changes. |
|
|
275
|
+
| `stepFps` | `number` | `0` | 0 … 60 | — | tunable | Stepped playback: each pose is held for 1/stepFps seconds, the clip sampled at its time floored to that step (12 is stop motion "on twos", 8 on threes), the same on every tick rate; 0 samples every tick. `time`, markers and root motion stay continuous; a one-shot still ends on its last frame. |
|
|
276
|
+
| `finished` | `boolean` | `false` | — | — | read only | Written: a non-looping clip reached its end. |
|
|
277
|
+
|
|
278
|
+
```ogt
|
|
279
|
+
component AnimationPlayer {
|
|
280
|
+
doc "Plays one clip on a skeleton. Alone it poses the skeleton from its rest pose; with an og.AnimationGraph it plays over the graph's result with `weight`. Changing `clip` cross-fades from the previous one over `fade`; a clip change starts the new clip at 0 (or at `time` if the game wrote it in the same tick)."
|
|
281
|
+
field clip ClipAsset "The clip asset; 0 plays nothing."
|
|
282
|
+
field time f32 "The playback position; written every tick, set it to seek (no markers fire across a seek)." {
|
|
283
|
+
min 0
|
|
284
|
+
unit s
|
|
285
|
+
}
|
|
286
|
+
field speed f32 "Playback rate (1 = as authored, negative plays backwards)." {
|
|
287
|
+
default 1
|
|
288
|
+
min -10
|
|
289
|
+
max 10
|
|
290
|
+
tunable true
|
|
291
|
+
}
|
|
292
|
+
field loop bool "Wrap at the end of the clip; otherwise hold the last frame and set `finished`." {
|
|
293
|
+
default true
|
|
294
|
+
}
|
|
295
|
+
field weight f32 "How much of the pose this player decides (0 = none, 1 = all)." {
|
|
296
|
+
default 1
|
|
297
|
+
min 0
|
|
298
|
+
max 1
|
|
299
|
+
tunable true
|
|
300
|
+
}
|
|
301
|
+
field fade f32 "Cross-fade duration when `clip` changes." {
|
|
302
|
+
default 0.2
|
|
303
|
+
min 0
|
|
304
|
+
max 10
|
|
305
|
+
unit s
|
|
306
|
+
tunable true
|
|
307
|
+
}
|
|
308
|
+
field stepFps f32 "Stepped playback: each pose is held for 1/stepFps seconds, the clip sampled at its time floored to that step (12 is stop motion \"on twos\", 8 on threes), the same on every tick rate; 0 samples every tick. `time`, markers and root motion stay continuous; a one-shot still ends on its last frame." {
|
|
309
|
+
min 0
|
|
310
|
+
max 60
|
|
311
|
+
tunable true
|
|
312
|
+
}
|
|
313
|
+
field finished bool "Written: a non-looping clip reached its end." {
|
|
314
|
+
readonly true
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
<sub>`api.ogt` line 5705</sub>
|
|
320
|
+
|
|
321
|
+
<a id="record-AnimationGraph"></a>
|
|
322
|
+
|
|
323
|
+
### `og.AnimationGraph` (component)
|
|
324
|
+
|
|
325
|
+
Runs a blend-tree graph (og.anim.graph) on a skeleton: its layers' state machines pick motions by the parameters p0...p7, which the graph names in `param` order (`param speed` is p0, the next `param` is p1, ...).
|
|
326
|
+
|
|
327
|
+
Token `og.AnimationGraph`, registered under the schema name `og.AnimationGraph`; its value type is `AnimationGraph`.
|
|
328
|
+
|
|
329
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
330
|
+
|---|---|---|---|---|---|---|
|
|
331
|
+
| `asset` | `GraphAsset` | `0` | — | — | — | The graph asset; 0 is none. |
|
|
332
|
+
| `weight` | `number` | `1` | 0 … 1 | — | tunable | How much of the pose the graph decides over the rest pose. |
|
|
333
|
+
| `speed` | `number` | `1` | 0 … 10 | — | tunable | A playback-rate multiplier for every layer. |
|
|
334
|
+
| `p0` | `number` | `0` | — | — | tunable | Parameter 0 (the graph's first `param`). |
|
|
335
|
+
| `p1` | `number` | `0` | — | — | tunable | Parameter 1. |
|
|
336
|
+
| `p2` | `number` | `0` | — | — | tunable | Parameter 2. |
|
|
337
|
+
| `p3` | `number` | `0` | — | — | tunable | Parameter 3. |
|
|
338
|
+
| `p4` | `number` | `0` | — | — | tunable | Parameter 4. |
|
|
339
|
+
| `p5` | `number` | `0` | — | — | tunable | Parameter 5. |
|
|
340
|
+
| `p6` | `number` | `0` | — | — | tunable | Parameter 6. |
|
|
341
|
+
| `p7` | `number` | `0` | — | — | tunable | Parameter 7. |
|
|
342
|
+
| `state` | `number` | `0` | — | — | read only | Written: the base layer's current state (its index in the graph file). |
|
|
343
|
+
| `stateTime` | `number` | `0` | — | `s` | read only | Written: seconds since the base layer entered `state`. |
|
|
344
|
+
|
|
345
|
+
```ogt
|
|
346
|
+
component AnimationGraph {
|
|
347
|
+
doc "Runs a blend-tree graph (og.anim.graph) on a skeleton: its layers' state machines pick motions by the parameters p0...p7, which the graph names in `param` order (`param speed` is p0, the next `param` is p1, ...)."
|
|
348
|
+
field asset GraphAsset "The graph asset; 0 is none."
|
|
349
|
+
field weight f32 "How much of the pose the graph decides over the rest pose." {
|
|
350
|
+
default 1
|
|
351
|
+
min 0
|
|
352
|
+
max 1
|
|
353
|
+
tunable true
|
|
354
|
+
}
|
|
355
|
+
field speed f32 "A playback-rate multiplier for every layer." {
|
|
356
|
+
default 1
|
|
357
|
+
min 0
|
|
358
|
+
max 10
|
|
359
|
+
tunable true
|
|
360
|
+
}
|
|
361
|
+
field p0 f32 "Parameter 0 (the graph's first `param`)." {
|
|
362
|
+
tunable true
|
|
363
|
+
}
|
|
364
|
+
field p1 f32 "Parameter 1." {
|
|
365
|
+
tunable true
|
|
366
|
+
}
|
|
367
|
+
field p2 f32 "Parameter 2." {
|
|
368
|
+
tunable true
|
|
369
|
+
}
|
|
370
|
+
field p3 f32 "Parameter 3." {
|
|
371
|
+
tunable true
|
|
372
|
+
}
|
|
373
|
+
field p4 f32 "Parameter 4." {
|
|
374
|
+
tunable true
|
|
375
|
+
}
|
|
376
|
+
field p5 f32 "Parameter 5." {
|
|
377
|
+
tunable true
|
|
378
|
+
}
|
|
379
|
+
field p6 f32 "Parameter 6." {
|
|
380
|
+
tunable true
|
|
381
|
+
}
|
|
382
|
+
field p7 f32 "Parameter 7." {
|
|
383
|
+
tunable true
|
|
384
|
+
}
|
|
385
|
+
field state u32 "Written: the base layer's current state (its index in the graph file)." {
|
|
386
|
+
readonly true
|
|
387
|
+
}
|
|
388
|
+
field stateTime f32 "Written: seconds since the base layer entered `state`." {
|
|
389
|
+
unit s
|
|
390
|
+
readonly true
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
<sub>`api.ogt` line 5744</sub>
|
|
396
|
+
|
|
397
|
+
<a id="record-Blendshapes"></a>
|
|
398
|
+
|
|
399
|
+
### `og.Blendshapes` (component)
|
|
400
|
+
|
|
401
|
+
Morph-target weights of the skeleton entity's mesh, in the order of the glTF mesh's targets. With `source` clips the playing clips' weight channels write them; with `component` game code does.
|
|
402
|
+
|
|
403
|
+
Token `og.Blendshapes`, registered under the schema name `og.Blendshapes`; its value type is `Blendshapes`.
|
|
404
|
+
|
|
405
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
406
|
+
|---|---|---|---|---|---|---|
|
|
407
|
+
| `source` | `BlendshapeSource` | `"component"` | — | — | — | Who decides the weights: component (game code writes w0...w7) or clips (the animation writes them). |
|
|
408
|
+
| `mesh` | `number` | `0` | ≥ 0 | — | — | The glTF mesh index whose targets the weights drive (0 is the first mesh). |
|
|
409
|
+
| `w0` | `number` | `0` | -1 … 2 | — | tunable | Weight of target 0. |
|
|
410
|
+
| `w1` | `number` | `0` | -1 … 2 | — | tunable | Weight of target 1. |
|
|
411
|
+
| `w2` | `number` | `0` | -1 … 2 | — | tunable | Weight of target 2. |
|
|
412
|
+
| `w3` | `number` | `0` | -1 … 2 | — | tunable | Weight of target 3. |
|
|
413
|
+
| `w4` | `number` | `0` | -1 … 2 | — | tunable | Weight of target 4. |
|
|
414
|
+
| `w5` | `number` | `0` | -1 … 2 | — | tunable | Weight of target 5. |
|
|
415
|
+
| `w6` | `number` | `0` | -1 … 2 | — | tunable | Weight of target 6. |
|
|
416
|
+
| `w7` | `number` | `0` | -1 … 2 | — | tunable | Weight of target 7. |
|
|
417
|
+
|
|
418
|
+
```ogt
|
|
419
|
+
component Blendshapes {
|
|
420
|
+
doc "Morph-target weights of the skeleton entity's mesh, in the order of the glTF mesh's targets. With `source` clips the playing clips' weight channels write them; with `component` game code does."
|
|
421
|
+
field source BlendshapeSource "Who decides the weights: component (game code writes w0...w7) or clips (the animation writes them)."
|
|
422
|
+
field mesh u32 "The glTF mesh index whose targets the weights drive (0 is the first mesh)." {
|
|
423
|
+
min 0
|
|
424
|
+
}
|
|
425
|
+
field w0 f32 "Weight of target 0." {
|
|
426
|
+
min -1
|
|
427
|
+
max 2
|
|
428
|
+
tunable true
|
|
429
|
+
}
|
|
430
|
+
field w1 f32 "Weight of target 1." {
|
|
431
|
+
min -1
|
|
432
|
+
max 2
|
|
433
|
+
tunable true
|
|
434
|
+
}
|
|
435
|
+
field w2 f32 "Weight of target 2." {
|
|
436
|
+
min -1
|
|
437
|
+
max 2
|
|
438
|
+
tunable true
|
|
439
|
+
}
|
|
440
|
+
field w3 f32 "Weight of target 3." {
|
|
441
|
+
min -1
|
|
442
|
+
max 2
|
|
443
|
+
tunable true
|
|
444
|
+
}
|
|
445
|
+
field w4 f32 "Weight of target 4." {
|
|
446
|
+
min -1
|
|
447
|
+
max 2
|
|
448
|
+
tunable true
|
|
449
|
+
}
|
|
450
|
+
field w5 f32 "Weight of target 5." {
|
|
451
|
+
min -1
|
|
452
|
+
max 2
|
|
453
|
+
tunable true
|
|
454
|
+
}
|
|
455
|
+
field w6 f32 "Weight of target 6." {
|
|
456
|
+
min -1
|
|
457
|
+
max 2
|
|
458
|
+
tunable true
|
|
459
|
+
}
|
|
460
|
+
field w7 f32 "Weight of target 7." {
|
|
461
|
+
min -1
|
|
462
|
+
max 2
|
|
463
|
+
tunable true
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
<sub>`api.ogt` line 5792</sub>
|
|
469
|
+
|
|
470
|
+
<a id="record-IkChain"></a>
|
|
471
|
+
|
|
472
|
+
### `og.IkChain` (component)
|
|
473
|
+
|
|
474
|
+
An inverse-kinematics constraint on a skeleton, applied after its clips and graph: the chain of `bones` bones ending at joint `tip` turns so the tip reaches `target`. Put it on its own entity (a skeleton can have many chains); chains apply in query order.
|
|
475
|
+
|
|
476
|
+
Token `og.IkChain`, registered under the schema name `og.IkChain`; its value type is `IkChain`.
|
|
477
|
+
|
|
478
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
479
|
+
|---|---|---|---|---|---|---|
|
|
480
|
+
| `skeleton` | `Entity` | `0` | — | — | — | The entity with the og.Skeleton this chain bends. |
|
|
481
|
+
| `tip` | `number` | `0` | ≥ 0 | — | — | The end joint (an index into the skin's joints): the foot or the hand. |
|
|
482
|
+
| `bones` | `number` | `2` | 1 … 32 | — | — | How many bones above the tip turn (two-bone always uses 2). |
|
|
483
|
+
| `solver` | `IkSolver` | `"twoBone"` | — | — | — | twoBone (analytic, with a pole) or fabrik (iterative, any length). |
|
|
484
|
+
| `target` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Where the tip should be, in `space`: for `world`, the frame of the skeleton entity's og.Transform (its parent's frame when it has a parent, not true world). |
|
|
485
|
+
| `pole` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | A point the middle joint bends towards (two-bone); the zero vector keeps the animated bend. |
|
|
486
|
+
| `space` | `IkSpace` | `"world"` | — | — | — | What `target` and `pole` are relative to: world (the frame the skeleton entity's og.Transform is in, so its parent's frame for a child entity, not true world) or model. |
|
|
487
|
+
| `weight` | `number` | `1` | 0 … 1 | — | tunable | How much of the solved rotation is applied (0 = the animated pose, 1 = fully solved). |
|
|
488
|
+
| `iterations` | `number` | `10` | 1 … 64 | — | — | FABRIK iterations at most. |
|
|
489
|
+
| `tolerance` | `number` | `0.001` | ≥ 0 | `m` | — | The tip distance (model units) at which the target counts as reached. |
|
|
490
|
+
| `reached` | `boolean` | `false` | — | — | read only | Written: the tip is within `tolerance` of the target after solving. |
|
|
491
|
+
| `error` | `number` | `0` | — | `m` | read only | Written: the tip's distance from the target after solving, in model units. |
|
|
492
|
+
|
|
493
|
+
```ogt
|
|
494
|
+
component IkChain {
|
|
495
|
+
doc "An inverse-kinematics constraint on a skeleton, applied after its clips and graph: the chain of `bones` bones ending at joint `tip` turns so the tip reaches `target`. Put it on its own entity (a skeleton can have many chains); chains apply in query order."
|
|
496
|
+
field skeleton Entity "The entity with the og.Skeleton this chain bends."
|
|
497
|
+
field tip u32 "The end joint (an index into the skin's joints): the foot or the hand." {
|
|
498
|
+
min 0
|
|
499
|
+
}
|
|
500
|
+
field bones u32 "How many bones above the tip turn (two-bone always uses 2)." {
|
|
501
|
+
default 2
|
|
502
|
+
min 1
|
|
503
|
+
max 32
|
|
504
|
+
}
|
|
505
|
+
field solver IkSolver "twoBone (analytic, with a pole) or fabrik (iterative, any length)."
|
|
506
|
+
field target Vector3 "Where the tip should be, in `space`: for `world`, the frame of the skeleton entity's og.Transform (its parent's frame when it has a parent, not true world)." {
|
|
507
|
+
unit m
|
|
508
|
+
}
|
|
509
|
+
field pole Vector3 "A point the middle joint bends towards (two-bone); the zero vector keeps the animated bend." {
|
|
510
|
+
unit m
|
|
511
|
+
}
|
|
512
|
+
field space IkSpace "What `target` and `pole` are relative to: world (the frame the skeleton entity's og.Transform is in, so its parent's frame for a child entity, not true world) or model."
|
|
513
|
+
field weight f32 "How much of the solved rotation is applied (0 = the animated pose, 1 = fully solved)." {
|
|
514
|
+
default 1
|
|
515
|
+
min 0
|
|
516
|
+
max 1
|
|
517
|
+
tunable true
|
|
518
|
+
}
|
|
519
|
+
field iterations u32 "FABRIK iterations at most." {
|
|
520
|
+
default 10
|
|
521
|
+
min 1
|
|
522
|
+
max 64
|
|
523
|
+
}
|
|
524
|
+
field tolerance f32 "The tip distance (model units) at which the target counts as reached." {
|
|
525
|
+
default 0.001
|
|
526
|
+
min 0
|
|
527
|
+
unit m
|
|
528
|
+
}
|
|
529
|
+
field reached bool "Written: the tip is within `tolerance` of the target after solving." {
|
|
530
|
+
readonly true
|
|
531
|
+
}
|
|
532
|
+
field error f32 "Written: the tip's distance from the target after solving, in model units." {
|
|
533
|
+
unit m
|
|
534
|
+
readonly true
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
<sub>`api.ogt` line 5840</sub>
|
|
540
|
+
|
|
541
|
+
<a id="record-AnimationEvent"></a>
|
|
542
|
+
|
|
543
|
+
### `og.AnimationEvent` (event)
|
|
544
|
+
|
|
545
|
+
A named marker of a clip that playback passed in the last tick (read in the tick after it fired, like every event). Cross-fades and blends fire every contributing clip's markers.
|
|
546
|
+
|
|
547
|
+
Token `og.AnimationEvent`, registered under the schema name `og.AnimationEvent`; its value type is `AnimationEvent`.
|
|
548
|
+
|
|
549
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
550
|
+
|---|---|---|---|---|---|---|
|
|
551
|
+
| `entity` | `Entity` | `0` | — | — | — | The skeleton entity. |
|
|
552
|
+
| `clip` | `ClipAsset` | `0` | — | — | — | The clip asset the marker belongs to. |
|
|
553
|
+
| `name` | `string` | `""` | — | — | — | The marker's name (at most 63 bytes). |
|
|
554
|
+
| `time` | `number` | `0` | — | `s` | — | The marker's time in the clip. |
|
|
555
|
+
| `weight` | `number` | `0` | — | — | — | The clip's blend weight when it fired. |
|
|
556
|
+
|
|
557
|
+
```ogt
|
|
558
|
+
event AnimationEvent {
|
|
559
|
+
doc "A named marker of a clip that playback passed in the last tick (read in the tick after it fired, like every event). Cross-fades and blends fire every contributing clip's markers."
|
|
560
|
+
field entity Entity "The skeleton entity."
|
|
561
|
+
field clip ClipAsset "The clip asset the marker belongs to."
|
|
562
|
+
field name String "The marker's name (at most 63 bytes)."
|
|
563
|
+
field time f32 "The marker's time in the clip." {
|
|
564
|
+
unit s
|
|
565
|
+
}
|
|
566
|
+
field weight f32 "The clip's blend weight when it fired."
|
|
567
|
+
}
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
<sub>`api.ogt` line 5884</sub>
|
|
571
|
+
|
|
572
|
+
<a id="record-Flipbook"></a>
|
|
573
|
+
|
|
574
|
+
### `og.Flipbook` (component)
|
|
575
|
+
|
|
576
|
+
Plays a clip of a flipbook sheet on the entity's og.Sprite: extraction draws the sprite with the sheet's texture and the current frame's region and pivot, or, for an `array true` sheet, the frame's layer of its texture array whole (the sprite keeps its size, colour, flips and layer). Played by the engine's og.flipbook system by scaled time (Time.scaledDt: slow motion, hit stop), after the game's systems.
|
|
577
|
+
|
|
578
|
+
Changing clip restarts at the clip's first frame (or at `time`, written in the same tick); writing a different time is a seek. Frame events are og.FlipbookEvent. The playback position is world state (the og.flipbook state block).
|
|
579
|
+
|
|
580
|
+
Token `og.Flipbook`, registered under the schema name `og.Flipbook`; its value type is `Flipbook`.
|
|
581
|
+
|
|
582
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
583
|
+
|---|---|---|---|---|---|---|
|
|
584
|
+
| `sheet` | `FlipbookSheet` | `0` | — | — | — | The sheet (og.load.flipbook's `sheet`); 0 is none. |
|
|
585
|
+
| `clip` | `number` | `0` | ≥ 0 | — | — | The clip: an index into FlipbookInfo.clips (og.anim.clip finds one by name). |
|
|
586
|
+
| `speed` | `number` | `1` | 0 … 10 | — | tunable | The playback rate: 1 as authored, 2 twice as fast, 0 holds the frame. |
|
|
587
|
+
| `playing` | `boolean` | `true` | — | — | — | Whether time advances. |
|
|
588
|
+
| `frame` | `number` | `0` | — | — | read only | Written: the clip frame shown (an index into the clip's frames). |
|
|
589
|
+
| `time` | `number` | `0` | ≥ 0 | `s` | — | Seconds into the current cycle; written every tick, set it to seek (no events fire across a seek). |
|
|
590
|
+
| `finished` | `boolean` | `false` | — | — | read only | Written: a `once` clip reached and holds its last frame. |
|
|
591
|
+
| `loops` | `number` | `0` | — | — | read only | Written: cycles completed by a looping or ping-pong clip. |
|
|
592
|
+
|
|
593
|
+
```ogt
|
|
594
|
+
component Flipbook {
|
|
595
|
+
doc "Plays a clip of a flipbook sheet on the entity's og.Sprite: extraction draws the sprite with the sheet's texture and the current frame's region and pivot, or, for an `array true` sheet, the frame's layer of its texture array whole (the sprite keeps its size, colour, flips and layer). Played by the engine's og.flipbook system by scaled time (Time.scaledDt: slow motion, hit stop), after the game's systems."
|
|
596
|
+
doc "Changing clip restarts at the clip's first frame (or at `time`, written in the same tick); writing a different time is a seek. Frame events are og.FlipbookEvent. The playback position is world state (the og.flipbook state block)."
|
|
597
|
+
field sheet FlipbookSheet "The sheet (og.load.flipbook's `sheet`); 0 is none."
|
|
598
|
+
field clip u32 "The clip: an index into FlipbookInfo.clips (og.anim.clip finds one by name)." {
|
|
599
|
+
min 0
|
|
600
|
+
}
|
|
601
|
+
field speed f32 "The playback rate: 1 as authored, 2 twice as fast, 0 holds the frame." {
|
|
602
|
+
default 1
|
|
603
|
+
min 0
|
|
604
|
+
max 10
|
|
605
|
+
tunable true
|
|
606
|
+
}
|
|
607
|
+
field playing bool "Whether time advances." {
|
|
608
|
+
default true
|
|
609
|
+
}
|
|
610
|
+
field frame u32 "Written: the clip frame shown (an index into the clip's frames)." {
|
|
611
|
+
readonly true
|
|
612
|
+
}
|
|
613
|
+
field time f32 "Seconds into the current cycle; written every tick, set it to seek (no events fire across a seek)." {
|
|
614
|
+
min 0
|
|
615
|
+
unit s
|
|
616
|
+
}
|
|
617
|
+
field finished bool "Written: a `once` clip reached and holds its last frame." {
|
|
618
|
+
readonly true
|
|
619
|
+
}
|
|
620
|
+
field loops u32 "Written: cycles completed by a looping or ping-pong clip." {
|
|
621
|
+
readonly true
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
<sub>`api.ogt` line 5992</sub>
|
|
627
|
+
|
|
628
|
+
<a id="record-FlipbookEvent"></a>
|
|
629
|
+
|
|
630
|
+
### `og.FlipbookEvent` (event)
|
|
631
|
+
|
|
632
|
+
A flipbook entered a frame its clip names in an `event` line (`event 2 "step"`): footsteps, the frame a hit lands, a pickup's sparkle. Read in the tick after, like every event; a clip started at 0 fires its first frame's events.
|
|
633
|
+
|
|
634
|
+
Token `og.FlipbookEvent`, registered under the schema name `og.FlipbookEvent`; its value type is `FlipbookEvent`.
|
|
635
|
+
|
|
636
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
637
|
+
|---|---|---|---|---|---|---|
|
|
638
|
+
| `entity` | `Entity` | `0` | — | — | — | The entity with the og.Flipbook. |
|
|
639
|
+
| `clip` | `number` | `0` | — | — | — | The clip index. |
|
|
640
|
+
| `frame` | `number` | `0` | — | — | — | The clip frame entered. |
|
|
641
|
+
| `name` | `string` | `""` | — | — | — | The event's name (at most 63 bytes). |
|
|
642
|
+
|
|
643
|
+
```ogt
|
|
644
|
+
event FlipbookEvent {
|
|
645
|
+
doc "A flipbook entered a frame its clip names in an `event` line (`event 2 \"step\"`): footsteps, the frame a hit lands, a pickup's sparkle. Read in the tick after, like every event; a clip started at 0 fires its first frame's events."
|
|
646
|
+
field entity Entity "The entity with the og.Flipbook."
|
|
647
|
+
field clip u32 "The clip index."
|
|
648
|
+
field frame u32 "The clip frame entered."
|
|
649
|
+
field name String "The event's name (at most 63 bytes)."
|
|
650
|
+
}
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
<sub>`api.ogt` line 6023</sub>
|
|
654
|
+
|
|
655
|
+
## Types
|
|
656
|
+
|
|
657
|
+
<a id="type-SkeletonAsset"></a>
|
|
658
|
+
|
|
659
|
+
### `SkeletonAsset` (handle)
|
|
660
|
+
|
|
661
|
+
A rig: a glTF's nodes in topological order with their rest transforms, and its skins (joints and inverse bind matrices).
|
|
662
|
+
|
|
663
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
664
|
+
|
|
665
|
+
```ogt
|
|
666
|
+
handle SkeletonAsset "A rig: a glTF's nodes in topological order with their rest transforms, and its skins (joints and inverse bind matrices)."
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
<sub>`api.ogt` line 5612</sub>
|
|
670
|
+
|
|
671
|
+
<a id="type-ClipAsset"></a>
|
|
672
|
+
|
|
673
|
+
### `ClipAsset` (handle)
|
|
674
|
+
|
|
675
|
+
An animation clip, resampled at the cook's rate, with its markers.
|
|
676
|
+
|
|
677
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
678
|
+
|
|
679
|
+
```ogt
|
|
680
|
+
handle ClipAsset "An animation clip, resampled at the cook's rate, with its markers."
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
<sub>`api.ogt` line 5613</sub>
|
|
684
|
+
|
|
685
|
+
<a id="type-GraphAsset"></a>
|
|
686
|
+
|
|
687
|
+
### `GraphAsset` (handle)
|
|
688
|
+
|
|
689
|
+
A blend-tree graph (`type animgraph`) whose clip references were resolved to clip handles.
|
|
690
|
+
|
|
691
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
692
|
+
|
|
693
|
+
```ogt
|
|
694
|
+
handle GraphAsset "A blend-tree graph (`type animgraph`) whose clip references were resolved to clip handles."
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
<sub>`api.ogt` line 5614</sub>
|
|
698
|
+
|
|
699
|
+
<a id="type-RootMotion"></a>
|
|
700
|
+
|
|
701
|
+
### `RootMotion` (enum)
|
|
702
|
+
|
|
703
|
+
What the root joint's motion does to the entity.
|
|
704
|
+
|
|
705
|
+
A string: one of the variants below. The zero value is `"off"`.
|
|
706
|
+
|
|
707
|
+
| Variant | Doc |
|
|
708
|
+
|---|---|
|
|
709
|
+
| `"off"` | The root animates in place; the entity does not move. |
|
|
710
|
+
| `"planar"` | The root's horizontal (xz) travel and yaw move og.Transform. |
|
|
711
|
+
| `"full"` | The root's whole translation and rotation move og.Transform. |
|
|
712
|
+
|
|
713
|
+
```ogt
|
|
714
|
+
enum RootMotion {
|
|
715
|
+
doc "What the root joint's motion does to the entity."
|
|
716
|
+
variant off "The root animates in place; the entity does not move."
|
|
717
|
+
variant planar "The root's horizontal (xz) travel and yaw move og.Transform."
|
|
718
|
+
variant full "The root's whole translation and rotation move og.Transform."
|
|
719
|
+
}
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
<sub>`api.ogt` line 5637</sub>
|
|
723
|
+
|
|
724
|
+
<a id="type-BlendshapeSource"></a>
|
|
725
|
+
|
|
726
|
+
### `BlendshapeSource` (enum)
|
|
727
|
+
|
|
728
|
+
Who decides blendshape weights.
|
|
729
|
+
|
|
730
|
+
A string: one of the variants below. The zero value is `"component"`.
|
|
731
|
+
|
|
732
|
+
| Variant | Doc |
|
|
733
|
+
|---|---|
|
|
734
|
+
| `"component"` | Game code writes w0...w7. |
|
|
735
|
+
| `"clips"` | The playing clips' weight channels write them. |
|
|
736
|
+
|
|
737
|
+
```ogt
|
|
738
|
+
enum BlendshapeSource {
|
|
739
|
+
doc "Who decides blendshape weights."
|
|
740
|
+
variant component "Game code writes w0...w7."
|
|
741
|
+
variant clips "The playing clips' weight channels write them."
|
|
742
|
+
}
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
<sub>`api.ogt` line 5651</sub>
|
|
746
|
+
|
|
747
|
+
<a id="type-IkSolver"></a>
|
|
748
|
+
|
|
749
|
+
### `IkSolver` (enum)
|
|
750
|
+
|
|
751
|
+
How an IK chain is solved.
|
|
752
|
+
|
|
753
|
+
A string: one of the variants below. The zero value is `"twoBone"`.
|
|
754
|
+
|
|
755
|
+
| Variant | Doc |
|
|
756
|
+
|---|---|
|
|
757
|
+
| `"twoBone"` | Analytic two-bone (thigh, shin, foot), bending towards the pole. |
|
|
758
|
+
| `"fabrik"` | FABRIK over `bones` bones, iteratively. |
|
|
759
|
+
|
|
760
|
+
```ogt
|
|
761
|
+
enum IkSolver {
|
|
762
|
+
doc "How an IK chain is solved."
|
|
763
|
+
variant twoBone "Analytic two-bone (thigh, shin, foot), bending towards the pole."
|
|
764
|
+
variant fabrik "FABRIK over `bones` bones, iteratively."
|
|
765
|
+
}
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
<sub>`api.ogt` line 5664</sub>
|
|
769
|
+
|
|
770
|
+
<a id="type-IkSpace"></a>
|
|
771
|
+
|
|
772
|
+
### `IkSpace` (enum)
|
|
773
|
+
|
|
774
|
+
What an IK chain's target and pole are relative to.
|
|
775
|
+
|
|
776
|
+
A string: one of the variants below. The zero value is `"world"`.
|
|
777
|
+
|
|
778
|
+
| Variant | Doc |
|
|
779
|
+
|---|---|
|
|
780
|
+
| `"world"` | Positions in the frame the skeleton entity's og.Transform is written in (its position, rotation and scale are undone): true world for a skeleton entity without a parent, its parent's frame for a child (a body under a character capsule takes targets relative to the capsule; transform world points by the parent's inverse yourself). |
|
|
781
|
+
| `"model"` | The skeleton's model space. |
|
|
782
|
+
|
|
783
|
+
```ogt
|
|
784
|
+
enum IkSpace {
|
|
785
|
+
doc "What an IK chain's target and pole are relative to."
|
|
786
|
+
variant world "Positions in the frame the skeleton entity's og.Transform is written in (its position, rotation and scale are undone): true world for a skeleton entity without a parent, its parent's frame for a child (a body under a character capsule takes targets relative to the capsule; transform world points by the parent's inverse yourself)."
|
|
787
|
+
variant model "The skeleton's model space."
|
|
788
|
+
}
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
<sub>`api.ogt` line 5677</sub>
|
|
792
|
+
|
|
793
|
+
<a id="type-ClipInfo"></a>
|
|
794
|
+
|
|
795
|
+
### `ClipInfo` (struct)
|
|
796
|
+
|
|
797
|
+
One clip of a loaded animation.
|
|
798
|
+
|
|
799
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
800
|
+
|---|---|---|---|---|---|---|
|
|
801
|
+
| `clip` | `ClipAsset` | `0` | — | — | — | Its handle, what AnimationPlayer.clip takes. |
|
|
802
|
+
| `name` | `string` | `""` | — | — | — | The glTF animation's name. |
|
|
803
|
+
| `duration` | `number` | `0` | — | `s` | — | Its length. |
|
|
804
|
+
| `markers` | `readonly string[]` | `[]` | — | — | — | Its markers' names, in time order. |
|
|
805
|
+
|
|
806
|
+
```ogt
|
|
807
|
+
struct ClipInfo {
|
|
808
|
+
doc "One clip of a loaded animation."
|
|
809
|
+
field clip ClipAsset "Its handle, what AnimationPlayer.clip takes."
|
|
810
|
+
field name String "The glTF animation's name."
|
|
811
|
+
field duration f32 "Its length." {
|
|
812
|
+
unit s
|
|
813
|
+
}
|
|
814
|
+
field markers List.String "Its markers' names, in time order."
|
|
815
|
+
}
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
<sub>`api.ogt` line 5895</sub>
|
|
819
|
+
|
|
820
|
+
<a id="type-Animation"></a>
|
|
821
|
+
|
|
822
|
+
### `Animation` (struct)
|
|
823
|
+
|
|
824
|
+
What og.load.animation registered from a model's `#anim` blob.
|
|
825
|
+
|
|
826
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
827
|
+
|---|---|---|---|---|---|---|
|
|
828
|
+
| `skeleton` | `SkeletonAsset` | `0` | — | — | — | The rig, what Skeleton.asset takes. |
|
|
829
|
+
| `clips` | `readonly ClipInfo[]` | `[]` | — | — | — | Its clips, in glTF order. |
|
|
830
|
+
| `nodes` | `readonly string[]` | `[]` | — | — | — | The rig's node names, in topological order. |
|
|
831
|
+
| `skins` | `readonly number[]` | `[]` | — | — | — | Each skin's joint count, in glTF order. |
|
|
832
|
+
| `morphTargets` | `number` | `0` | — | — | — | Morph targets across the model's meshes. |
|
|
833
|
+
|
|
834
|
+
```ogt
|
|
835
|
+
struct Animation {
|
|
836
|
+
doc "What og.load.animation registered from a model's `#anim` blob."
|
|
837
|
+
field skeleton SkeletonAsset "The rig, what Skeleton.asset takes."
|
|
838
|
+
field clips List.ClipInfo "Its clips, in glTF order."
|
|
839
|
+
field nodes List.String "The rig's node names, in topological order."
|
|
840
|
+
field skins List.u32 "Each skin's joint count, in glTF order."
|
|
841
|
+
field morphTargets u32 "Morph targets across the model's meshes."
|
|
842
|
+
}
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
<sub>`api.ogt` line 5905</sub>
|
|
846
|
+
|
|
847
|
+
<a id="type-GraphDesc"></a>
|
|
848
|
+
|
|
849
|
+
### `GraphDesc` (desc struct)
|
|
850
|
+
|
|
851
|
+
A blend-tree graph to register.
|
|
852
|
+
|
|
853
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
854
|
+
|
|
855
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
856
|
+
|---|---|---|---|---|---|---|
|
|
857
|
+
| `text` | `string` | `""` | — | — | — | The graph's `.ogt` text (`type animgraph`, `version 1`; og-game §9 has every line). |
|
|
858
|
+
| `clips` | `readonly ClipInfo[]` | `[]` | — | — | — | The clips a `clip <motion> "<name>"` line may name, by ClipInfo.name: usually og.load.animation's `clips`. |
|
|
859
|
+
|
|
860
|
+
```ogt
|
|
861
|
+
struct GraphDesc {
|
|
862
|
+
doc "A blend-tree graph to register."
|
|
863
|
+
desc true
|
|
864
|
+
field text String "The graph's `.ogt` text (`type animgraph`, `version 1`; og-game §9 has every line)."
|
|
865
|
+
field clips List.ClipInfo "The clips a `clip <motion> \"<name>\"` line may name, by ClipInfo.name: usually og.load.animation's `clips`."
|
|
866
|
+
}
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
<sub>`api.ogt` line 5914</sub>
|
|
870
|
+
|
|
871
|
+
<a id="type-Rig"></a>
|
|
872
|
+
|
|
873
|
+
### `Rig` (handle)
|
|
874
|
+
|
|
875
|
+
A humanoid map from og.load.rig (a cooked `.ogt` of `type rig`): the naming scheme a skeleton's node names follow and the standard bones it names outright.
|
|
876
|
+
|
|
877
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
878
|
+
|
|
879
|
+
```ogt
|
|
880
|
+
handle Rig "A humanoid map from og.load.rig (a cooked `.ogt` of `type rig`): the naming scheme a skeleton's node names follow and the standard bones it names outright."
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
<sub>`api.ogt` line 5928</sub>
|
|
884
|
+
|
|
885
|
+
<a id="type-HumanBone"></a>
|
|
886
|
+
|
|
887
|
+
### `HumanBone` (struct)
|
|
888
|
+
|
|
889
|
+
One standard humanoid bone of a skeleton.
|
|
890
|
+
|
|
891
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
892
|
+
|---|---|---|---|---|---|---|
|
|
893
|
+
| `bone` | `string` | `""` | — | — | — | The standard bone: hips, spine, chest, upperChest, neck, head, then leftShoulder, leftUpperArm, leftLowerArm, leftHand, the right arm, leftUpperLeg, leftLowerLeg, leftFoot, leftToes and the right leg. |
|
|
894
|
+
| `node` | `string` | `""` | — | — | — | The skeleton node that is that bone. |
|
|
895
|
+
|
|
896
|
+
```ogt
|
|
897
|
+
struct HumanBone {
|
|
898
|
+
doc "One standard humanoid bone of a skeleton."
|
|
899
|
+
field bone String "The standard bone: hips, spine, chest, upperChest, neck, head, then leftShoulder, leftUpperArm, leftLowerArm, leftHand, the right arm, leftUpperLeg, leftLowerLeg, leftFoot, leftToes and the right leg."
|
|
900
|
+
field node String "The skeleton node that is that bone."
|
|
901
|
+
}
|
|
902
|
+
```
|
|
903
|
+
|
|
904
|
+
<sub>`api.ogt` line 5930</sub>
|
|
905
|
+
|
|
906
|
+
<a id="type-Humanoid"></a>
|
|
907
|
+
|
|
908
|
+
### `Humanoid` (struct)
|
|
909
|
+
|
|
910
|
+
Which node of a skeleton is each standard humanoid bone (what retargeting maps).
|
|
911
|
+
|
|
912
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
913
|
+
|---|---|---|---|---|---|---|
|
|
914
|
+
| `scheme` | `string` | `""` | — | — | — | The naming scheme the bones were read in: mixamo, vrm, unity, rigify, ue or blender; custom when a rig named them, none when nothing matched. |
|
|
915
|
+
| `bones` | `readonly HumanBone[]` | `[]` | — | — | — | The bones found, in the standard order (hips first). |
|
|
916
|
+
|
|
917
|
+
```ogt
|
|
918
|
+
struct Humanoid {
|
|
919
|
+
doc "Which node of a skeleton is each standard humanoid bone (what retargeting maps)."
|
|
920
|
+
field scheme String "The naming scheme the bones were read in: mixamo, vrm, unity, rigify, ue or blender; custom when a rig named them, none when nothing matched."
|
|
921
|
+
field bones List.HumanBone "The bones found, in the standard order (hips first)."
|
|
922
|
+
}
|
|
923
|
+
```
|
|
924
|
+
|
|
925
|
+
<sub>`api.ogt` line 5936</sub>
|
|
926
|
+
|
|
927
|
+
<a id="type-HumanoidDesc"></a>
|
|
928
|
+
|
|
929
|
+
### `HumanoidDesc` (desc struct)
|
|
930
|
+
|
|
931
|
+
A skeleton and, optionally, the rig that says how its bones are named.
|
|
932
|
+
|
|
933
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
934
|
+
|
|
935
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
936
|
+
|---|---|---|---|---|---|---|
|
|
937
|
+
| `skeleton` | `SkeletonAsset` | `0` | — | — | — | The skeleton (og.load.animation's `skeleton`). |
|
|
938
|
+
| `rig` | `Rig` | `0` | — | — | — | A humanoid map from og.load.rig; 0 detects the bones from the node names (Mixamo, VRM, Unity, Rigify, Unreal or Blender names). |
|
|
939
|
+
|
|
940
|
+
```ogt
|
|
941
|
+
struct HumanoidDesc {
|
|
942
|
+
doc "A skeleton and, optionally, the rig that says how its bones are named."
|
|
943
|
+
desc true
|
|
944
|
+
field skeleton SkeletonAsset "The skeleton (og.load.animation's `skeleton`)."
|
|
945
|
+
field rig Rig "A humanoid map from og.load.rig; 0 detects the bones from the node names (Mixamo, VRM, Unity, Rigify, Unreal or Blender names)."
|
|
946
|
+
}
|
|
947
|
+
```
|
|
948
|
+
|
|
949
|
+
<sub>`api.ogt` line 5942</sub>
|
|
950
|
+
|
|
951
|
+
<a id="type-RetargetDesc"></a>
|
|
952
|
+
|
|
953
|
+
### `RetargetDesc` (desc struct)
|
|
954
|
+
|
|
955
|
+
A clip made for one skeleton, to play on another (other proportions, rest pose or bone names).
|
|
956
|
+
|
|
957
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
958
|
+
|
|
959
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
960
|
+
|---|---|---|---|---|---|---|
|
|
961
|
+
| `clip` | `ClipAsset` | `0` | — | — | — | The clip, made for `source`. |
|
|
962
|
+
| `source` | `SkeletonAsset` | `0` | — | — | — | The skeleton the clip was made for (og.load.animation's `skeleton`: a character's, or an animation library's). |
|
|
963
|
+
| `target` | `SkeletonAsset` | `0` | — | — | — | The skeleton that will play it. |
|
|
964
|
+
| `sourceRig` | `Rig` | `0` | — | — | — | How the source's bones are named (og.load.rig); 0 detects them. |
|
|
965
|
+
| `targetRig` | `Rig` | `0` | — | — | — | How the target's bones are named; 0 detects them. |
|
|
966
|
+
| `footIk` | `boolean` | `true` | — | — | — | Solve the legs so a planted foot stays planted on the target's ground (and the hips lower when a leg cannot reach). |
|
|
967
|
+
|
|
968
|
+
```ogt
|
|
969
|
+
struct RetargetDesc {
|
|
970
|
+
doc "A clip made for one skeleton, to play on another (other proportions, rest pose or bone names)."
|
|
971
|
+
desc true
|
|
972
|
+
field clip ClipAsset "The clip, made for `source`."
|
|
973
|
+
field source SkeletonAsset "The skeleton the clip was made for (og.load.animation's `skeleton`: a character's, or an animation library's)."
|
|
974
|
+
field target SkeletonAsset "The skeleton that will play it."
|
|
975
|
+
field sourceRig Rig "How the source's bones are named (og.load.rig); 0 detects them."
|
|
976
|
+
field targetRig Rig "How the target's bones are named; 0 detects them."
|
|
977
|
+
field footIk bool "Solve the legs so a planted foot stays planted on the target's ground (and the hips lower when a leg cannot reach)." {
|
|
978
|
+
default true
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
```
|
|
982
|
+
|
|
983
|
+
<sub>`api.ogt` line 5956</sub>
|
|
984
|
+
|
|
985
|
+
<a id="type-FlipbookSheet"></a>
|
|
986
|
+
|
|
987
|
+
### `FlipbookSheet` (handle)
|
|
988
|
+
|
|
989
|
+
A sprite sheet's frames and clips (a cooked `.ogt` of `type flipbook`), from og.load.flipbook.
|
|
990
|
+
|
|
991
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
992
|
+
|
|
993
|
+
```ogt
|
|
994
|
+
handle FlipbookSheet "A sprite sheet's frames and clips (a cooked `.ogt` of `type flipbook`), from og.load.flipbook."
|
|
995
|
+
```
|
|
996
|
+
|
|
997
|
+
<sub>`api.ogt` line 5976</sub>
|
|
998
|
+
|
|
999
|
+
<a id="type-FlipMode"></a>
|
|
1000
|
+
|
|
1001
|
+
### `FlipMode` (enum)
|
|
1002
|
+
|
|
1003
|
+
How a flipbook clip runs past its last frame.
|
|
1004
|
+
|
|
1005
|
+
A string: one of the variants below. The zero value is `"loop"`.
|
|
1006
|
+
|
|
1007
|
+
| Variant | Doc |
|
|
1008
|
+
|---|---|
|
|
1009
|
+
| `"loop"` | Back to the first frame. |
|
|
1010
|
+
| `"pingPong"` | Back and forth, without repeating the end frames. |
|
|
1011
|
+
| `"once"` | Hold the last frame and set Flipbook.finished. |
|
|
1012
|
+
|
|
1013
|
+
```ogt
|
|
1014
|
+
enum FlipMode {
|
|
1015
|
+
doc "How a flipbook clip runs past its last frame."
|
|
1016
|
+
variant loop "Back to the first frame."
|
|
1017
|
+
variant pingPong "Back and forth, without repeating the end frames."
|
|
1018
|
+
variant once "Hold the last frame and set Flipbook.finished."
|
|
1019
|
+
}
|
|
1020
|
+
```
|
|
1021
|
+
|
|
1022
|
+
<sub>`api.ogt` line 5985</sub>
|
|
1023
|
+
|
|
1024
|
+
<a id="type-FlipbookClipInfo"></a>
|
|
1025
|
+
|
|
1026
|
+
### `FlipbookClipInfo` (struct)
|
|
1027
|
+
|
|
1028
|
+
One clip of a loaded flipbook sheet.
|
|
1029
|
+
|
|
1030
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1031
|
+
|---|---|---|---|---|---|---|
|
|
1032
|
+
| `clip` | `number` | `0` | — | — | — | Its index, what Flipbook.clip takes. |
|
|
1033
|
+
| `name` | `string` | `""` | — | — | — | Its name in the sheet. |
|
|
1034
|
+
| `frames` | `number` | `0` | — | — | — | How many frames. |
|
|
1035
|
+
| `duration` | `number` | `0` | — | `s` | — | Seconds of one cycle (a ping-pong cycle goes there and back). |
|
|
1036
|
+
| `mode` | `FlipMode` | `"loop"` | — | — | — | How it runs past its end. |
|
|
1037
|
+
| `events` | `readonly string[]` | `[]` | — | — | — | Its events' names, in frame order. |
|
|
1038
|
+
|
|
1039
|
+
```ogt
|
|
1040
|
+
struct FlipbookClipInfo {
|
|
1041
|
+
doc "One clip of a loaded flipbook sheet."
|
|
1042
|
+
field clip u32 "Its index, what Flipbook.clip takes."
|
|
1043
|
+
field name String "Its name in the sheet."
|
|
1044
|
+
field frames u32 "How many frames."
|
|
1045
|
+
field duration f32 "Seconds of one cycle (a ping-pong cycle goes there and back)." {
|
|
1046
|
+
unit s
|
|
1047
|
+
}
|
|
1048
|
+
field mode FlipMode "How it runs past its end."
|
|
1049
|
+
field events List.String "Its events' names, in frame order."
|
|
1050
|
+
}
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
<sub>`api.ogt` line 6031</sub>
|
|
1054
|
+
|
|
1055
|
+
<a id="type-FlipbookInfo"></a>
|
|
1056
|
+
|
|
1057
|
+
### `FlipbookInfo` (struct)
|
|
1058
|
+
|
|
1059
|
+
What og.load.flipbook registered.
|
|
1060
|
+
|
|
1061
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1062
|
+
|---|---|---|---|---|---|---|
|
|
1063
|
+
| `sheet` | `FlipbookSheet` | `0` | — | — | — | What Flipbook.sheet takes. |
|
|
1064
|
+
| `texture` | `Texture` | `0` | — | — | — | The sheet's texture (loaded with it; sampled nearest unless the sheet says `filter linear`); 0 for an `array true` sheet. |
|
|
1065
|
+
| `array` | `TextureArray` | `0` | — | — | — | An `array true` sheet's texture array (its frames as layers, loaded with it); 0 otherwise. |
|
|
1066
|
+
| `clips` | `readonly FlipbookClipInfo[]` | `[]` | — | — | — | Its clips, in sheet order. |
|
|
1067
|
+
| `frames` | `number` | `0` | — | — | — | Frames in the sheet. |
|
|
1068
|
+
| `frameWidth` | `number` | `0` | — | — | — | The first frame's width in pixels. |
|
|
1069
|
+
| `frameHeight` | `number` | `0` | — | — | — | The first frame's height in pixels. |
|
|
1070
|
+
|
|
1071
|
+
```ogt
|
|
1072
|
+
struct FlipbookInfo {
|
|
1073
|
+
doc "What og.load.flipbook registered."
|
|
1074
|
+
field sheet FlipbookSheet "What Flipbook.sheet takes."
|
|
1075
|
+
field texture Texture "The sheet's texture (loaded with it; sampled nearest unless the sheet says `filter linear`); 0 for an `array true` sheet."
|
|
1076
|
+
field array TextureArray "An `array true` sheet's texture array (its frames as layers, loaded with it); 0 otherwise."
|
|
1077
|
+
field clips List.FlipbookClipInfo "Its clips, in sheet order."
|
|
1078
|
+
field frames u32 "Frames in the sheet."
|
|
1079
|
+
field frameWidth u32 "The first frame's width in pixels."
|
|
1080
|
+
field frameHeight u32 "The first frame's height in pixels."
|
|
1081
|
+
}
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
<sub>`api.ogt` line 6043</sub>
|
|
1085
|
+
|
|
1086
|
+
## Column kinds
|
|
1087
|
+
|
|
1088
|
+
Each is a factory, `SkeletonAsset(value?, options?)`, that makes one field of a component or resource layout.
|
|
1089
|
+
|
|
1090
|
+
| Column | Value | Typed array | Stride | Doc |
|
|
1091
|
+
|---|---|---|---|---|
|
|
1092
|
+
| <a id="column-SkeletonAsset"></a>`SkeletonAsset` | `SkeletonAsset` | `Uint32Array` | 2 | A SkeletonAsset handle field. |
|
|
1093
|
+
| <a id="column-ClipAsset"></a>`ClipAsset` | `ClipAsset` | `Uint32Array` | 2 | A ClipAsset handle field. |
|
|
1094
|
+
| <a id="column-GraphAsset"></a>`GraphAsset` | `GraphAsset` | `Uint32Array` | 2 | A GraphAsset handle field. |
|
|
1095
|
+
| <a id="column-RootMotion"></a>`RootMotion` | `RootMotion` | `Uint32Array` | 1 | A RootMotion field: the variant's index. |
|
|
1096
|
+
| <a id="column-BlendshapeSource"></a>`BlendshapeSource` | `BlendshapeSource` | `Uint32Array` | 1 | A BlendshapeSource field: the variant's index. |
|
|
1097
|
+
| <a id="column-IkSolver"></a>`IkSolver` | `IkSolver` | `Uint32Array` | 1 | An IkSolver field: the variant's index. |
|
|
1098
|
+
| <a id="column-IkSpace"></a>`IkSpace` | `IkSpace` | `Uint32Array` | 1 | An IkSpace field: the variant's index. |
|
|
1099
|
+
| <a id="column-FlipbookSheet"></a>`FlipbookSheet` | `FlipbookSheet` | `Uint32Array` | 2 | A FlipbookSheet handle field. |
|
|
1100
|
+
|
|
1101
|
+
```ogt
|
|
1102
|
+
column SkeletonAsset {
|
|
1103
|
+
doc "A SkeletonAsset handle field."
|
|
1104
|
+
array Uint32Array
|
|
1105
|
+
stride 2
|
|
1106
|
+
value SkeletonAsset
|
|
1107
|
+
}
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
<sub>`api.ogt` line 5616</sub>
|
|
1111
|
+
|
|
1112
|
+
```ogt
|
|
1113
|
+
column ClipAsset {
|
|
1114
|
+
doc "A ClipAsset handle field."
|
|
1115
|
+
array Uint32Array
|
|
1116
|
+
stride 2
|
|
1117
|
+
value ClipAsset
|
|
1118
|
+
}
|
|
1119
|
+
```
|
|
1120
|
+
|
|
1121
|
+
<sub>`api.ogt` line 5623</sub>
|
|
1122
|
+
|
|
1123
|
+
```ogt
|
|
1124
|
+
column GraphAsset {
|
|
1125
|
+
doc "A GraphAsset handle field."
|
|
1126
|
+
array Uint32Array
|
|
1127
|
+
stride 2
|
|
1128
|
+
value GraphAsset
|
|
1129
|
+
}
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
<sub>`api.ogt` line 5630</sub>
|
|
1133
|
+
|
|
1134
|
+
```ogt
|
|
1135
|
+
column RootMotion {
|
|
1136
|
+
doc "A RootMotion field: the variant's index."
|
|
1137
|
+
array Uint32Array
|
|
1138
|
+
stride 1
|
|
1139
|
+
value RootMotion
|
|
1140
|
+
}
|
|
1141
|
+
```
|
|
1142
|
+
|
|
1143
|
+
<sub>`api.ogt` line 5644</sub>
|
|
1144
|
+
|
|
1145
|
+
```ogt
|
|
1146
|
+
column BlendshapeSource {
|
|
1147
|
+
doc "A BlendshapeSource field: the variant's index."
|
|
1148
|
+
array Uint32Array
|
|
1149
|
+
stride 1
|
|
1150
|
+
value BlendshapeSource
|
|
1151
|
+
}
|
|
1152
|
+
```
|
|
1153
|
+
|
|
1154
|
+
<sub>`api.ogt` line 5657</sub>
|
|
1155
|
+
|
|
1156
|
+
```ogt
|
|
1157
|
+
column IkSolver {
|
|
1158
|
+
doc "An IkSolver field: the variant's index."
|
|
1159
|
+
array Uint32Array
|
|
1160
|
+
stride 1
|
|
1161
|
+
value IkSolver
|
|
1162
|
+
}
|
|
1163
|
+
```
|
|
1164
|
+
|
|
1165
|
+
<sub>`api.ogt` line 5670</sub>
|
|
1166
|
+
|
|
1167
|
+
```ogt
|
|
1168
|
+
column IkSpace {
|
|
1169
|
+
doc "An IkSpace field: the variant's index."
|
|
1170
|
+
array Uint32Array
|
|
1171
|
+
stride 1
|
|
1172
|
+
value IkSpace
|
|
1173
|
+
}
|
|
1174
|
+
```
|
|
1175
|
+
|
|
1176
|
+
<sub>`api.ogt` line 5683</sub>
|
|
1177
|
+
|
|
1178
|
+
```ogt
|
|
1179
|
+
column FlipbookSheet {
|
|
1180
|
+
doc "A FlipbookSheet handle field."
|
|
1181
|
+
array Uint32Array
|
|
1182
|
+
stride 2
|
|
1183
|
+
value FlipbookSheet
|
|
1184
|
+
}
|
|
1185
|
+
```
|
|
1186
|
+
|
|
1187
|
+
<sub>`api.ogt` line 5978</sub>
|