AutoMovie API
    Preparing search index...

    Bake the attachTo verb into the child object's follow clip, the per-frame realisation of a rigid coupling to a parent's bone (a sword in a hand, a prop on a saddle). The child is not a rig, so, like a projectile, it moves by a node clip of translation and rotation tracks, not a pose motion.

    Each sample resolves the parent's posed skeleton at that instant through resolveAttachment, which runs the parent's FK, to compose the child's bone-local offset into the parent's model space, then composes that onto the parent's world frame: its staged placement, or, when the parent itself rides a coupling this shot, its ridden frame from parentTransformAt (#1140):

    • translation = parentPos + parentRot · childLocal.translation
    • rotation = parentRot ∘ childLocal.rotation

    The parent's scale is not applied, which matches the renderer for the unit-scale actors staging places. Pass the same jointAxes the renderer poses the parent with (HUMANOID_JOINT_AXES), plus the same restFrames when parent clips are authored in clinical space, or the child follows a bone where the renderer does not draw it. A parent with no motion holds its rest pose.

    The clip is shot-local: N = max(1, round(duration × fps)) equal intervals give N + 1 keys including both ends of [start, start + duration], with duration set to shotDuration, the same convention as cameraMotion. Read alone through sampleClip it clamps to the child's first frame before start; playback reads it through sampleClipSequence, where it writes nothing before start and holds its last frame after the coupling ends. The clip id is attach:<child>; a caller baking several couplings of one child suffixes repeats. Throws a RangeError for nonfinite/nonpositive duration or fps, or an unsafe rounded interval count that cannot support an advancing indexed loop. This representability gate is not a workload cap; callers still own feasible memory use and representable distinct key times.

    type IProps = {
        bone: AutoMovieHumanoidBone;
        child: string;
        duration: number;
        fps?: number;
        jointAxes?: Partial<Record<AutoMovieHumanoidBone, IAutoMovieJointAxes>>;
        offset?: IAutoMovieRigidTransform;
        parentMotion?: IAutoMovieMotion;
        parentSkeleton: IAutoMovieSkeleton;
        parentTransform: IAutoMovieTransform;
        parentTransformAt?: (t: number) => IAutoMovieTransform | null;
        restFrames?: Partial<Record<AutoMovieHumanoidBone, IAutoMovieRestFrame>>;
        shotDuration: number;
        start: number;
    }

    Hierarchy (View Summary)

    Index

    The parent bone the child rides.

    child: string

    The coupled child's scene node: the clip's target.

    duration: number

    Length of the coupling in seconds; must be finite and positive.

    fps?: number

    Samples per second of the baked follow; defaults to 30.

    jointAxes?: Partial<Record<AutoMovieHumanoidBone, IAutoMovieJointAxes>>

    Clinical-axis remap for the parent's FK, such as HUMANOID_JOINT_AXES.

    Child frame in the posed bone, with finite metre translation and a unit rotation. Defaults to the identity.

    parentMotion?: IAutoMovieMotion

    The parent's compiled pose motion; absent, the parent holds its rest pose.

    parentSkeleton: IAutoMovieSkeleton

    The parent's rig, for the per-frame FK.

    parentTransform: IAutoMovieTransform

    The parent's staged world placement.

    parentTransformAt?: (t: number) => IAutoMovieTransform | null

    The parent's ridden world frame at shot-local second t, or null before its coupling starts. The staged parentTransform applies when no ridden frame exists. Omit for a parent that holds its staged placement throughout. Called synchronously once per baked key, including both endpoints; neither the callback nor returned frame is retained. Exceptions abort baking.

    restFrames?: Partial<Record<AutoMovieHumanoidBone, IAutoMovieRestFrame>>

    Per-rig clinical rest-frame remap for the parent's FK.

    shotDuration: number

    The shot's length in seconds, which the clip's duration spans.

    start: number

    Shot-local second the coupling begins.