Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development How to Make a Video Game Player Input and Cameras Move the Player with Animation

Thanitsak Leuangsupornpong
Thanitsak Leuangsupornpong
7,490 Points

I just want to know that how does the frog move without modified its transform?

As I play the game right now I am a little confused about the frog's transform, because in the code there are no code that modify the frogs transform, but when the game run and I pressed the WASD the Z position in the transform component keep adding up.

If because of the animation can someone please give me a link so that I can learn how to do that great animation.

And will it take a lot of CPU or GPU in order to complete that process instead of a pure animation and use transform.translate or Rigidbody.Moveposition .

Thank you in advance!

1 Answer

The magic happens with the Animator controller (and the animation itself). In the official Unity Manual (https://docs.unity3d.com/Manual/class-Animator.html) you can see that "Apply Root Motion" is responsible for moving without a script.

I'll leave you two links for further research: https://docs.unity3d.com/Manual/RootMotion.html http://answers.unity3d.com/questions/1238987/whats-root-motion-and-how-it-works.html

Hope I could help you :)