I have attached an animation + animator controller on a Zombie model, but the thing is that only the animation plays the Walk forward animation, but the character does not move along with the animation, how can i make it so it moves with the animation, i dont really know how to tell, but hopefully someone knows how to fix this issue! Thanks in advance
Hi I think this is easy to fix:
You really have 2 options here:
- If the animation in your modelling program not only animated the bones but also “moved” the character you only have to click the “Apply root motion” checkbox on the animator component See this link, and this link to understand further the root motion. That way, when the animation plays it will automatically move.
- The second option is the most “powerful” but also the most hard to implement and is to program manually the movement of your character without the “Apply root motion”. add a script to the gameObject where you have your model and using input translate or rotate the gameObject at will. You can see a “Scripting root motion tutorial” here but you can make it simpler and just translate the transform in the direction your model is facing. You can always take a look at how the built-in character controllers are made and try to mimic them.
If you have more doubts I’ll try to extend my answer a little.
Here i am giving you the solution :
First make an empty game object , then add the player sprite as a child .
Add all the rigidbodies and the Box colliders to the empty game object
Also add the player control script to the empty game object
will solve your problem