Skip to content

@aosengine/assets-aosrig ​

Type Aliases ​

AosrigManifestEntry ​

ts
type AosrigManifestEntry = AssetEntry;

A manifest entry for the rig: @aosengine/assets's own AssetEntry, under a name that says where it came from.

It is deliberately not a second declaration of the same shape. The entry goes straight into parseManifest, so a local copy could only ever drift from the type that is actually validated.

Example ​

ts
import type { AosrigManifestEntry } from '@aosengine/assets-aosrig';
import { aosrigManifestEntry } from '@aosengine/assets-aosrig';

const entry: AosrigManifestEntry = aosrigManifestEntry('char.hero');
console.log(entry.type); // 'character'

Variables ​

AOSRIG_ASSETS_BASE ​

ts
const AOSRIG_ASSETS_BASE: string;

Absolute URL of the directory holding the packaged assets, with a trailing slash.

Use it as a manifest baseUrl. It resolves against this module, so it is correct from src/ under the development condition, from dist/ in a published install, and from whatever path a bundler emits.

Example ​

ts
import { AOSRIG_ASSETS_BASE } from '@aosengine/assets-aosrig';

console.log(AOSRIG_ASSETS_BASE.endsWith('/assets/')); // true

AOSRIG_CLIP_SPEEDS ​

ts
const AOSRIG_CLIP_SPEEDS: Readonly<Record<string, number>>;

Ground speed each locomotion clip was baked at, in metres per second.

The host reads the same numbers out of the GLB's extras.aos.speed; they are repeated here so a game can tune its own walk and run speeds against the clips without parsing the file. Match them and the feet do not skate.

Example ​

ts
import { AOSRIG_CLIP_SPEEDS } from '@aosengine/assets-aosrig';

console.log(AOSRIG_CLIP_SPEEDS.walk, AOSRIG_CLIP_SPEEDS.run); // 1.4 3.6

AOSRIG_CLIPS ​

ts
const AOSRIG_CLIPS: readonly string[];

The clip names embedded in the GLB, in the order it declares them.

idle, walk and run carry extras.aos.locomotion = true, so the host builds its locomotion blend from them and picks between them by speed; wave does not, so it only plays when a guest asks for it by name with character.setClipWeights.

Example ​

ts
import { AOSRIG_CLIPS } from '@aosengine/assets-aosrig';

console.log(AOSRIG_CLIPS); // ['idle', 'walk', 'run', 'wave']

AOSRIG_GLB_FILE ​

ts
const AOSRIG_GLB_FILE: "aosrig_v0.glb";

File name of the rig inside assets/.

Example ​

ts
import { AOSRIG_GLB_FILE } from '@aosengine/assets-aosrig';

console.log(AOSRIG_GLB_FILE); // 'aosrig_v0.glb'

AOSRIG_HEAD_AIM_JOINTS ​

ts
const AOSRIG_HEAD_AIM_JOINTS: readonly readonly [string, number][];

How a look-at is shared between the neck and the head.

The rig has one neck joint rather than Unreal's two, so the default neck_01 / neck_02 / head split does not apply: 40 % on c_neck and 60 % on c_head gives the same overall turn without the neck kinking. Feed it to createAnimator({ headAim: { joints: AOSRIG_HEAD_AIM_JOINTS } }).

Example ​

ts
import { AOSRIG_HEAD_AIM_JOINTS } from '@aosengine/assets-aosrig';

const total = AOSRIG_HEAD_AIM_JOINTS.reduce((sum, [, share]) => sum + share, 0);
console.log(total); // 1

AOSRIG_HEAD_JOINT ​

ts
const AOSRIG_HEAD_JOINT: "c_head";

The head joint, and the leaf of the spine chain.

Its presence is what tells the host it is looking at an aosrig skeleton rather than an Unreal one.

Example ​

ts
import { AOSRIG_HEAD_JOINT, AOSRIG_JOINTS } from '@aosengine/assets-aosrig';

console.log(AOSRIG_JOINTS.includes(AOSRIG_HEAD_JOINT)); // true

AOSRIG_HEIGHT ​

ts
const AOSRIG_HEIGHT: 1.73 = 1.73;

Standing height of the rig in its bind pose, in metres.

Feet are at y = 0, so this is also the top of the head. Use it to place a camera or size a physics capsule against the character you are actually going to draw.

Example ​

ts
import { AOSRIG_HEIGHT } from '@aosengine/assets-aosrig';

const eyeHeight = AOSRIG_HEIGHT * 0.94;
console.log(eyeHeight > 1.6); // true

AOSRIG_JOINTS ​

ts
const AOSRIG_JOINTS: readonly string[];

Every joint of the rig, in the order the GLB's skin declares them.

This is the canonical body skeleton: splat characters are trained against these names, so a clip authored for one aosrig character plays on any other. The order matters — it is the JOINTS_0 index space — and src/pack.test.ts asserts the committed GLB still agrees with this list joint for joint.

Index 0 is body_world (the skin's skeleton root, at the origin), index 1 is root (the hips) and index 113 is c_head. The 34 *_proc entries are procedural twist joints driven by MHR's forward kinematics; nothing should pose them by hand.

Example ​

ts
import { AOSRIG_JOINTS } from '@aosengine/assets-aosrig';

console.log(AOSRIG_JOINTS.length); // 114
console.log(AOSRIG_JOINTS[0], AOSRIG_JOINTS[1]); // 'body_world' 'root'

AOSRIG_ROOT_JOINT ​

ts
const AOSRIG_ROOT_JOINT: "root";

The hips joint: the one the animator reads root motion from.

body_world is joint 0 and sits at the origin carrying the vertical bob; root is the hips, at 0.924 m in the bind pose. Pass it as createAnimator({ bones: { root: AOSRIG_ROOT_JOINT } }), because the animator's own default is Unreal's pelvis.

Example ​

ts
import { AOSRIG_ROOT_JOINT } from '@aosengine/assets-aosrig';

console.log(AOSRIG_ROOT_JOINT); // 'root'

PACKAGE ​

ts
const PACKAGE: "@aosengine/assets-aosrig";

Package identity marker.

Example ​

ts
import { PACKAGE } from '@aosengine/assets-aosrig';

console.log(PACKAGE); // '@aosengine/assets-aosrig'

Functions ​

aosrigAssetUrl() ​

ts
function aosrigAssetUrl(file): string;

The absolute URL of one packaged file.

This is the escape hatch for tooling that wants the bytes directly. Game logic must not call it: assets are addressed by id (AGENTS.md rule 3). A bundled app should prefer import url from '@aosengine/assets-aosrig/assets/aosrig_v0.glb?url', which gets the file copied into dist/ with a hashed name.

Parameters ​

ParameterTypeDescription
filestringA file name inside assets/, for example aosrig_v0.glb.

Returns ​

string

The absolute URL of that file.

Example ​

ts
import { aosrigAssetUrl, AOSRIG_GLB_FILE } from '@aosengine/assets-aosrig';

const url = aosrigAssetUrl(AOSRIG_GLB_FILE);
console.log(url.endsWith('/assets/aosrig_v0.glb')); // true

aosrigManifestEntry() ​

ts
function aosrigManifestEntry(id, src?): AssetEntry;

Build the manifest entry for the rig under an id of your choosing.

The skinned backend takes no pack: everything the host needs — the mesh, the 114-joint skin and the four clips — is inside the one GLB.

Parameters ​

ParameterTypeDefault valueDescription
idstringundefinedThe string id game logic will name, for example char.hero.
srcstringAOSRIG_GLB_FILEWhere the GLB is, relative to the manifest's baseUrl. Defaults to AOSRIG_GLB_FILE.

Returns ​

AssetEntry

The entry, ready to drop into a manifest's assets array.

Example ​

ts
import { parseManifest } from '@aosengine/assets';
import { aosrigManifestEntry, AOSRIG_ASSETS_BASE } from '@aosengine/assets-aosrig';

const manifest = parseManifest(
  { version: 1, assets: [aosrigManifestEntry('char.hero'), aosrigManifestEntry('char.guide')] },
  { baseUrl: AOSRIG_ASSETS_BASE },
);
console.log(manifest.assets.map((a) => a.id)); // ['char.hero', 'char.guide']