Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Construct() - Engine

Calls Construct() from the generic runtime, then modifies bones based on user options and engine quirks.

function Construct(armature: Armature*, options: ConstructOptions): Bone[] {
    finalBones: Bone[] = GenericRuntime::Construct(armature)

    for(let bone of finalBones) {
        // engine quirks like negative Y or reversed rotations can be applied here
        bone.pos.y = -bone.pos.y
        bone.rot   = -bone.rot

        // apply user options
        bone.scale *= options.scale
        bone.pos   *= options.scale
        bone.pos   += options.position

        GenericRuntime.CheckBoneFlip(bone, options.scale)

        // engine quirks & user options applied to vertices
        for(let vert of bone.vertices) {
            vert.pos.y = -vert.pos.y
            vert.pos   *= options.scale
            vert.pos   += options.position
        }
    }

    return finalBones
}