@threenative/procedural-animals API
Every public function and class in @threenative/procedural-animals. Optional, bake-first procedural animal content for ThreeNative.
On this page
Generated from the engine's capability manifest: 7 functions. Each entry is the exported signature, what it is for, and a working example. Start with the package overview.
createAnimalActor
Own one actor's pose/lifetime, accepting the completed physics state as its only root writer.
function createAnimalActor(bake: IAnimalBake, options: IAnimalActorOptions)Needs
- npm i @threenative/procedural-animals
Use it to
- follow a baked animal from accepted fixed-step Rapier state
Example
const wolf = createAnimalActor(bake, { motion, material, ground });Good to know
- identity parent required; material and motion are editable game source; no move/Mixer/composer writer exists
createAnimalGeometry
Validates all bytes before constructing geometry with the bake's skin and rig attributes.
function createAnimalGeometry(buffer: ArrayBuffer):Needs
- npm i @threenative/procedural-animals
Use it to
- construct a Three.js geometry from a validated procedural wolf bake
Example
const { bake, geometry } = createAnimalGeometry(bytes);Good to know
- this creates bind geometry only; game-owned DQS material and animated bounds remain required
loadAnimalBake
Resolves and loads a prebuilt wolf through the game's ordinary asset resolver.
async function loadAnimalBake( assets: IAnimalAssetResolver, logicalPath: string, options:Needs
- npm i @threenative/procedural-animals
Use it to
- load a cooked animal from ctx.assets without runtime generation
Example
const bake = await loadAnimalBake(ctx.assets, "wolf.animal");Good to know
- a corrupt served bake rejects rather than falling back to a different file
parseAnimalBake
Validates a pinned wolf PANM bake before constructing any renderer resource.
function parseAnimalBake(buffer: ArrayBuffer): IAnimalBakeNeeds
- npm i @threenative/procedural-animals
Use it to
- validate a baked procedural animal before allocating geometry
Example
const bake = parseAnimalBake(bytes);Good to know
- unknown revisions, malformed sections, indices and skin weights throw by name
animalBakePass
Validate staged PANM sources inside the existing asset compiler; it owns the hashed manifest.
function animalBakePass()Needs
- npm i @threenative/procedural-animals
Use it to
- cook staged animal bakes through the ordinary asset pipeline
Example
await compileAssets({ passes: [animalBakePass()] });Good to know
- only .animal inputs are interpreted; corruption fails the cook, without regeneration
bakeWolf
Bake the pinned wolf on the build machine, never on the portable runtime path.
async function bakeWolf(options: IWolfBakeOptions): Promise<ArrayBuffer>Needs
- npm i @threenative/procedural-animals
Use it to
- bake high and crowd wolf geometry before the ordinary asset cook
Example
const bytes = await bakeWolf({ seed: 7, tier: "crowd" });Good to know
- exact pinned Node runtime, donor revision, options and generated bytes are validated; no worker is created
bakeWolfToFile
Stage a validated source bake with a same-directory atomic rename, then use compileAssets.
async function bakeWolfToFile( options: IWolfBakeOptions, destination: string, ): Promise<string>Needs
- npm i @threenative/procedural-animals
Use it to
- publish a generated wolf without replacing the last valid bake on interruption
Example
await bakeWolfToFile({ seed: 7, tier: "crowd" }, "assets/wolf-crowd.animal");Good to know
- validation and generation complete before the destination is touched; temporary files are removed on failure