---
title: "extractRootMotion(jointName:options:lockPosition:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/sampledanimation/skeletalanimationoperation/extractrootmotion(jointname:options:lockposition:)"
---

# extractRootMotion(jointName:options:lockPosition:)

Extracts root motion from the specified joint.

## Declaration

```swift
static func extractRootMotion(jointName: String, options: SampledAnimation<Value>.SkeletalAnimationOperation.RootMotionOptions = .translationXZ, lockPosition: Transform? = nil) -> SampledAnimation<Value>.SkeletalAnimationOperation
```

## Parameters

- `jointName`: Name of the joint to extract root motion from.
- `options`: Transform components to extract.
- `lockPosition`: Position to lock the root joint to after extraction.

## Return Value

Return Value A SkeletalAnimationOperation that, when processed, produces an AnimationGroup containing both the modified skeletal animation and the extracted SRT sampled animation used for root motion.

## Discussion

Discussion Removes the specified transform components from the joint and returns them as a separate SampledAnimation<Transform> in the resulting AnimationGroup. The skeletal animation will have the extracted motion removed. When you extract root motion, the function returns an AnimationGroup containing both the skeletal animation and the root motion animation. Playing back this group triggers root motion events in sync with the skeletal animation. The event callback receives the delta transform moved between the last frame and the current frame. If no event handler subscribes to the root motion on the target entity, the system automatically applies the delta to the entity’s transform.

## See Also

### Extracting root motion

- [SampledAnimation.SkeletalAnimationOperation.RootMotionOptions](realitykit/sampledanimation/skeletalanimationoperation/rootmotionoptions.md)
