Contents

automatchBiped(_:sourceTransform:to:targetTransform:jointOffsets:)

Creates a retargeting configuration for bipedal characters with custom root transforms.

Declaration

@MainActor static func automatchBiped(_ sourceSkeleton: SkeletonResource, sourceTransform: Transform = .identity, to targetSkeleton: SkeletonResource, targetTransform: Transform = .identity, jointOffsets: [String : simd_quatf] = [:]) throws -> RetargetingConfiguration

Parameters

  • sourceSkeleton:

    The skeleton of the animation to retarget.

  • sourceTransform:

    Transform applied to the source skeleton’s root during matching (defaults to identity).

  • targetSkeleton:

    The skeleton that will receive the re-targeted animation.

  • targetTransform:

    Transform applied to the target skeleton’s root during matching (defaults to identity).

  • jointOffsets:

    Optional quaternion offsets applied to specific joints during configuration creation. Keys must match joint names in the target skeleton. The function applies offsets on top of the automatically detected joint correspondences and bakes them into the configuration.

Return Value

A configured retargeting instance ready for animation processing.

Discussion

This overload allows you to specify custom transforms for the root bones of both skeletons, which is useful when the characters are positioned or oriented differently in their bind poses. The function applies the transforms during the automatic matching process to establish proper correspondences.

The automatic matching algorithm has the same joint requirements and behavior as automatchBiped(_:to:jointOffsets:).

Example

do {
    // Source character facing +Z, target facing +X
    let sourceTransform = Transform(rotation: simd_quatf(angle: 0, axis: simd_float3(0, 1, 0)))
    let targetTransform = Transform(rotation: simd_quatf(angle: .pi/2, axis: simd_float3(0, 1, 0)))

    let config = try RetargetingConfiguration.automatchBiped(
        sourceSkeleton,
        sourceTransform: sourceTransform,
        to: targetSkeleton,
        targetTransform: targetTransform
    )
} catch {
    print("Failed to create retargeting configuration: \(error.localizedDescription)")
}

See Also

Creating a configuration