Complete the code to enable root motion on the Animator component.
Animator animator = GetComponent<Animator>();
animator.[1] = true;The correct property to enable root motion is applyRootMotion.
Complete the code to override root motion in the Animator by implementing the correct method.
void [1]() {
// Custom root motion handling
}The method OnAnimatorMove is called when root motion is applied and can be overridden for custom handling.
Fix the error in the code to correctly apply root motion delta to the transform.
void OnAnimatorMove() {
transform.position += [1];
transform.rotation *= animator.deltaRotation;
}The correct property to get the root motion position change is animator.deltaPosition.
Fill both blanks to create a dictionary that maps animation clip names to their root motion curves.
Dictionary<string, AnimationCurve> rootMotionCurves = new Dictionary<string, AnimationCurve>() {
{ [1], [2] }
};The key should be the animation clip name as a string, and the value should be the corresponding AnimationCurve variable.
Fill all three blanks to correctly update the Animator's root motion position and rotation in OnAnimatorMove.
void OnAnimatorMove() {
Vector3 rootPos = transform.position + [1];
Quaternion rootRot = transform.rotation * [2];
transform.SetPositionAndRotation(rootPos, [3]);
}The root motion delta position and rotation are added to the current transform, then applied using SetPositionAndRotation.