- Home /
how do I make my character walk?
i want to make an rpg with unity but i dont know how to make my character walk. ive already made my character with a run, walk and idle animation with blender and imported it into unity. but i dont know how to make my character do his animation when i press the buttons on my keyboard. all i know is that its somehow done with scripting, and im hopeless at scripting. so can anyone write me a script or tell me how i would do this?
Answer by skovacs1 · Dec 13, 2010 at 08:53 PM
Check out the tutorials. Read and understand what they are doing. They have scripts that do exactly what you are trying to do. Unless you are paying them to do so, you would be hard-pressed to find someone willing to do all the work for you.
Simple code is something along the lines of:
function Update() {
var v = Input.GetAxis("Vertical");
if(Mathf.Abs(v) > 0.1f) {
animation["Walk"].speed = v;
animation.CrossFade("Walk");
transform.position.z += v;
}
else animation.CrossFade("Idle");
}
i dont understand the tutorial of lerpz which is the only one that covers animating a character im taking A STRESS HERE $$anonymous$$AN ARRRR!!!!! ive been trying to do this for about a week now and im no where closer than where i started please i need help!!!!!!!
If you don't understand the tutorials, rather than shouting and pestering people to do everything for you, try asking about the specific part of the tutorial that is giving you so much grief. $$anonymous$$ost of the tutorials have scripts called somethingOrOtherAnimation which do pretty much exactly what I've posted. They have some somethingOrOtherController which sets a variable is$$anonymous$$oving to true when $$anonymous$$athf.Abs(something) > 0.1f and then in the somethingOrOtherAnimation, they check somethingOrOtherController.is$$anonymous$$oving and play the appropriate animation. The 2D platformer tutorial is simplest - start there.
im sorry for shouting im was just really angry, sorry again.
Your answer
Follow this Question
Related Questions
How to make natural character animations? 1 Answer
Blender Animation Problems 3 Answers
split animations problems 2 Answers