Contents

BlendTreeSourceNode

A blend node that contains an animation.

Declaration

struct BlendTreeSourceNode

Overview

This structure adopts BlendTreeNode and adds the ability to store a single animation. A complete BlendTreeAnimation represents a mix of all the animations that its source nodes contain. Each source node defines a weight that determines how much effect the source’s animation has in the blend tree’s resulting, mixed animation. To define the source’s animation, set this structure’s source property.

Access a source node of a blend tree

A source may exist in any leaf-node position in the blend animation’s tree. The following code checks the root node for a source. If instead the root node is a branch, the code begins checking the branches sources.

// Check if the root node is a source.
if let blendNode = blendTree.root as? BlendTreeSourceNode {
    // Found a source.

// Check if the root node is a branch.
} else if let source = blendTree.root as? BlendTreeBlendNode {

        // Check for a source in the branch's sources.
        if let source = blendNode.sources[0] as? BlendTreeSourceNode {
            // Found a source.
        }
    }
}

Topics

Creating a blend tree animation node

Configuring a blend tree animation node

See Also

Blend trees