Question by
GGpple · May 21, 2021 at 05:58 PM ·
scripting problemanimatorroot motion
Apply root motion when using Animator.Play()
Recently I try to use Animator.Play() to play state/clip frame by frame, but I found the avatar didn't have the built in root motion by doing this method. Here is code snap about what I want to do:
while (current_frame <= end_frame) {
// this loop is put in the IEnumerator so can be called by StartCoroutine()
float current = Normalize(current_frame ,end_frame);
// play clip frame by frame and I expect root motion happened
animator.Play(root.name, 0, current);
animator.speed = 0.0f;
// to get the position data after root motion in every frame
GetPositionData();
yield return new WaitForEndOfFrame();
}
Does anyone know the way to achieve it?
Comment
Your answer
Follow this Question
Related Questions
When I run this code Unity crashes(ANIMATOR RELATED) 0 Answers
MatchTarget Rotating Character 0 Answers
Animation plays for a second 0 Answers
How to get perfect position animation with root motion? 1 Answer
Player teleports when animation finishes 0 Answers