Interface VatHandle
clips: Record<string, VatClip>;
mesh: Mesh;
play(clip: string, opts?: { fps?: number; offset?: number }): void;
setInstances(params: Float32Array): void;
setInstancesBlend(params: Float32Array): void;
update(dtSeconds: number): void;
}
Properties
Readonlyclips
Baked clip row map.
Readonlymesh
The mesh this drives (its mesh.vat is set).
Methods
play
-
Select the clip to play (by name) or set explicit playback params.
Parameters
- clip: string
Optionalopts: { fps?: number; offset?: number }
Returns void
set Instances
-
Enable/refresh PER-INSTANCE VAT: upload one vec4 (fromRow, toRow, timeOffset, fps) per thin-instance, so every instance plays its own clip + phase from the one shared baked texture (all instances in a single draw call).
params.lengthmust be4 * instanceCount. Call this BEFORE registerScene the first time — it setsmesh.vat.instanceTexture; a VAT mesh that is thin-instanced then takes the per-instance vertex path. Later calls re-upload in place. Useclipsto look up each clip's fromRow/toRow/fps when buildingparams. (Internally expanded to the dual-clip layout, blend 0.)Parameters
- params: Float32Array
Returns void
set Instances Blend
-
PER-INSTANCE DUAL-CLIP VAT: like setInstances, but each instance carries TWO clips that are blended, so gait cross-fades stay smooth.
params.lengthmust be8 * instanceCount— two vec4s per instance: A = (fromRowA, toRowA, timeOffset, fpsA), B = (fromRowB, toRowB, blendWeight, fpsB), where blendWeight in [0,1] lerps A→B and B reuses A's timeOffset. Same per-instance VAT path as setInstances.Parameters
- params: Float32Array
Returns void
update
-
Advance the animation clock by
dtSecondsand upload it.Parameters
- dtSeconds: number
Returns void
Runtime VAT playback handle for one mesh (the analogue of BJS BakedVertexAnimationManager + the per-mesh settings). Advance
update()each frame; set the active clip withplay().