- Home /
character movement script
i have create a character in blender and exported it as .fbx. I just want to know if you can give me a sample script so that I can call the animation "walk_cycle" so that my character will be able to walk on my game. thanks
Answer by dannyskim · Dec 06, 2011 at 12:04 AM
Your title and post are a bit confusing. Do you want to just call the animation to play on a button press? Or did you want to call the animation playing while moving as well?
A basic play would be:
void Update()
{
if( Input.GetMouseButtonDown(0) )
{
animation.Play( "walk_cycle" );
}
}
This will play the animation when you press the left mouse button on the Game View.
for example, when i press "W" the character will move forward... or if i press "S" the cracter will move backward.. I just want to know the basic script since I have a problem in understanding the tutorial, I am more on playing a sample script.. thanks
Your answer
![](https://koobas.hobune.stream/wayback/20220613061812im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
problem with character motion and movement 1 Answer
animation in blender to unity 0 Answers
Hungry Shark Evolution Movement 0 Answers
Strange Character Movement (Mecanim) 0 Answers
Children won't animate 2 Answers