- Home /
Animation... Unity 3D...Blender...3rd Person
Hello, I have a fully rigged, and animated 3D Model for my 3rd Person game, and, when i import the model into Unity, and play it, setup character controls and camera controls, it does the animation for 3 seconds, then stops and when i press W to move forward, it just glides and does not do the animation, Could someone please give me a script, or code, or something so i can fix that? Thanks!
Here is my Character Control...
Any help would be very appreciated, thanks!
Answer by Peter G · May 02, 2010 at 01:17 AM
You need to actually call the animation to play.
if(isWalking) { animation.CrossFade("walk"); }
else if (moveDirection != Vector3.zero) { animation.CrossFade("run"); }
else animation.CrossFade("idle");
It also sounds like the loop mode on your animations is off. You probably have the setting on once when it should be on loop. To see the various options for looping click here. Depending on how you imported your animations do the following:
If you created a single animation in Blender and split it in the importer, find the animation in the importer and select loop as your wrap mode.
If you imported your objects using object@animation syntax, then, in the start function of your animation script add:
animation["walk"].wrapMode = WrapMode.Loop;
This way the animation will keep playing forever instead of reaching the end of the animation and returning to the starting position.
Thank you, I added the animation in, but there is one problem, the animation keeps going on after i press "W", even when i've stopped, it wont stop :(
Answer by Larry-Dietz · May 02, 2010 at 12:42 AM
Looking at your script, it looks like you only have comments saying //invoke walk animation here. etc...
Unless I am missing something, you need to replace those comments with the actual code to play the animation...
Something like...
gameobject.animation.Play ("walk");
Hope this helps,
-Larry
Your answer
Follow this Question
Related Questions
Changing specific animation of a person 1 Answer
Trouble with animations. 0 Answers
how alternate walk cycle javascript 1 Answer
How Can I Get The Pants to Not Move? 4 Answers
Menu Movements 1 Answer