extractRootMotion(jointName:options:lockPosition:)
Extracts root motion from the specified joint.
Declaration
static func extractRootMotion(jointName: String, options: SampledAnimation<Value>.SkeletalAnimationOperation.RootMotionOptions = .translationXZ, lockPosition: Transform? = nil) -> SampledAnimation<Value>.SkeletalAnimationOperationParameters
- 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
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
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.