I probably have a blackout and therefore need some help: I can’t get this simple animation to behave correctly. The problem here is that the animation doesn’t stop at the position which is supposed to be the end of the animation (which is the same position as the beginning of the animation) - but instead it stops shortly before going back to the starting position. It is as if he skips the last couple of frames. I don’t know what is wrong. I simply want to execute the animation from beginning to end time as soon as I pressed the mouse button (wrapmode is already set to “once”).
function Update()
{
if(Input.GetMouseButton(0))
attack();
}
function attack()
{
transform.Find("Armature").animation.Play("push");
yield WaitForSeconds(transform.Find("Armature").animation["push"].length);
transform.Find("Armature").animation.Stop("push");
}
I know that some animation software has frames per second issues. Try messing around with the frames per second in your animation software. I think I read somewhere that maya must be set to 30 fps. This is assuming you are using 3rd party animation software and that you have set the beginning and end frames correctly in the inspector. Remember to make wrao mode “ONCE”. Also set the beginning and end frame.
See attached image…

Hmm I used blender 2.54 and the animation was exactly 21 frames. But its really simple animation. Just a cube that goes forward and then backward. So in Unity I put in:
Start: 1, End: 21
When I put in Start:1 End: 50 - the result looks better (because the animation ends a little bit closer to its initial position), but it still hasn’t reached its initial position exactly. I can put the endframe even higher, but it still doesn’t end correctly… what is wrong here?
Do you export to fbx file? If so, do you have the latest fbx exporter? I’m not sure how this works with blender:) Also, did you mess around with the frame rate in Blender?
Tiaan
That was it, thanks: reason for the error obviously is the collada exporter (!) of blender, which I used. Damn this madness - hours of thinking wasted in trying to do workarounds - just to find out it’s the blender exporter who sux. It works correctly with the .fbx exporter.
Yup, fbx seems to be the way to go with most software…