---
title: "processAndCreateAnimation(retargeting:operations:name:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/sampledanimation/processandcreateanimation(retargeting:operations:name:)"
---

# processAndCreateAnimation(retargeting:operations:name:)

Processes skeletal animation with the specified retargeting and operations.

## Declaration

```swift
func processAndCreateAnimation(retargeting config: RetargetingConfiguration, operations: [SampledAnimation<Value>.SkeletalAnimationOperation] = [], name: String = "") throws -> any AnimationDefinition
```

## Parameters

- `config`: The skeletal retargeting configuration to use.
- `operations`: Operations to perform on the animation. If empty, only retargeting is performed.
- `name`: Name for the processed animation.

## Return Value

Return Value An AnimationDefinition containing the processed animation. If root motion extraction is performed, returns an AnimationGroup containing both the skeletal animation (SampledAnimation<JointTransforms>) and extracted root motion (SampledAnimation<Transform>). Otherwise returns a SampledAnimation<JointTransforms>.

## Discussion

Discussion Retargets the instance animation using the provided retargeting configuration and applies a series of skeletal animation processing operations to create a new animation definition. The function executes operations in the order specified. note: An error if validation fails. All errors provide descriptive messages via their localizedDescription property. Common validation failures include: Duplicate operation types in a single call (e.g., two extractRootMotion operations). Both extractRootMotion and removeAnimation(for:) operations in the same call. Operations requiring a skeleton when skeleton parameter is nil. Joint name does not exist in the skeleton for root motion extraction or removal. Base animation has a different sample rate than the source animation for convertToAdditive.

## See Also

### Processing skeletal animations

- [processAndCreateAnimation(for:operations:name:)](realitykit/sampledanimation/processandcreateanimation(for:operations:name:).md)
- [SampledAnimation.SkeletalAnimationOperation](realitykit/sampledanimation/skeletalanimationoperation.md)
