- Home /
I'm having animation problems
I can't seem to get animations to play in Unity. This is the workflow that I used.
-Character modeled in 3ds Max 7 and is rigged with biped and uses skin.
-I downloaded 3 biped files (walk, run, standby) and applied them to the character model
-I exported the character as a .fbx file using 3ds max 2011 using default export settings
-I edited the animation so it was facing the correct direction and would walk in place in Motionbuilder 2011
-I then added the model to my Unity assets
-I set frames 0 - 32 as "walk" and 50 - 90 as "idle" and set both of their WrapModes to "loop" and left everything else the same
-I deselected the "Play Automatically" checkbox
-Then I added the following script to the character
//Taken from //http://unity3d.com/support/documentation/Manual/Animation%20Scripting.html
function Update () {
if (Input.GetAxis("Vertical") > 0.2)
animation.CrossFade ("walk");
else
animation.CrossFade ("idle");
}
Now when I click play nothing happens. I can push the arrow keys and WASD keys and nothing happens. When I check "Play Automatically" The walk animation plays on a loop without any keys being pressed, and pressing keys does nothing. I've tried multiple things, but can't seem to get it right. Anyone have any suggestions?
I can't really see anything wrong with what you told. Try putting some Debug.Log in your code to make sure it is executed. Or post your project here - maybe someone will figure out.
Post the whole script not the snippet for us to see which part causes the problem.