Contents

SkeletonResource.JointBuilder

A result builder for declaratively constructing the children of a joint.

Declaration

@resultBuilder struct JointBuilder

Overview

Inside the Joint(_:restPoseTransform:children:) closure, you can write any mix of:

  • Joint literals — each becomes one child of the parent joint.

    try Joint("root") {
        try Joint("spine")
        try Joint("hip")
    }
    // root.children == [spine, hip]
  • [Joint] values — each element becomes a child of the parent joint, in array order, alongside any other declarations in the same closure body. Use this when the children are produced from runtime data (e.g. mapped from a flat array) rather than spelled out as literals.

    let kids: [Joint] = ...
    try Joint("root") {
        kids   // every element of kids becomes a child of root
    }

Both forms can be mixed freely. Each Joint in any array can itself be a fully built subtree.

Topics

Building joints

Type Methods

See Also

Defining the joint hierarchy