Animation · class

BlendTree

Explained in Animation.

class BlendTree
import { BlendTree } from '@driftengine/animation';

Constructor

new

constructor(root: BlendNode, jointCount: number, bind?: Pose | undefined)
ParameterTypeDescription
rootBlendNode
jointCountnumber
bind?Pose | undefinedThe bind pose, or omitted for one whose channels start at rest. Supply it whenever the clips are rotation-only, which is most of them. sampleClip leaves a channel no track mentions exactly as it found it, so a rotation-only clip preserves whatever translations the pose already held. blendPoses cannot do that — it interpolates every channel of two poses — so without a bind pose here the scratch poses start at zero translation and every joint collapses onto its parent's origin the moment a tree or a transition is involved. Found by building a demo scene with it: one figure folded in on itself and the other, which happened to go through retargetPose instead, did not.

Methods

set

set(parameter: string, value: number): void

Set a parameter, refusing a name no node declares.

ParameterTypeDescription
parameterstring
valuenumber
More

Loud rather than ignored. A typo silently does nothing, and what a consumer then sees is an animation that will not respond — a symptom a long way from the misspelling that caused it, and one no test of theirs would catch. What it costs is that a caller cannot set a parameter ahead of building the tree that uses it.

evaluate

evaluate(timeSec: number, out: Pose): void

Sample the whole tree at timeSec into out. Allocates nothing.

ParameterTypeDescription
timeSecnumber
outPose
More

timeSec is the clock for every node that did not name one of its own, so a tree of ordinary clips behaves exactly as it did before clocks existed.