<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/SampledAnimation/processAndCreateAnimation(retargeting:operations:name:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation16SampledAnimationVA2A15JointTransformsVRszrlE016processAndCreateD011retargeting10operations4nameAA0D10Definition_pAA24RetargetingConfigurationC_SayAcaERszrlE08SkeletalD9OperationVyAE_GGSStKF"
  },
  "title" : "processAndCreateAnimation(retargeting:operations:name:)"
}
-->

# processAndCreateAnimation(retargeting:operations:name:)

Processes skeletal animation with the specified retargeting and operations.

```
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

An [`AnimationDefinition`](/documentation/RealityKit/AnimationDefinition) containing the processed animation. If root motion
extraction is performed, returns an [`AnimationGroup`](/documentation/RealityKit/AnimationGroup) containing both the
skeletal animation (`SampledAnimation<JointTransforms>`) and extracted
root motion (`SampledAnimation<Transform>`). Otherwise returns a
`SampledAnimation<JointTransforms>`.

## 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.

> Throws: 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 ``doc://com.apple.RealityKit/documentation/RealityKit/SampledAnimation/SkeletalAnimationOperation/extractRootMotion(jointName:options:lockPosition:)`` operations).
> - Both ``doc://com.apple.RealityKit/documentation/RealityKit/SampledAnimation/SkeletalAnimationOperation/extractRootMotion(jointName:options:lockPosition:)`` and ``doc://com.apple.RealityKit/documentation/RealityKit/SampledAnimation/SkeletalAnimationOperation/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 ``doc://com.apple.RealityKit/documentation/RealityKit/SampledAnimation/SkeletalAnimationOperation/convertToAdditive(baseAnimation:)``.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)