Hi, so I imported a 3ds max file (converted to a FBX first) and it did have an animation. I was wondering how do I use that animation in unity. When I place it in the scene view, it is at its first frame (which I want until I want it to reload). How do I play the animation? Thanks!
http://puu.sh/2iqCZ
Notice the Take 001 in the prefab and the Animator component.
1 Answer
1
http://docs.unity3d.com/Documentation/Manual/AnimationScripting40.html
the docs are pretty good on this, take the time to read them…
Now, once you’ve put the model into your project, you can select it in the Assets panel, and then it’s import data becomes available on the Project panel… Select the animation tab at the top…
On the animation tab, I have selected the clip (highlighted in blue), which opens further info regarding the anim… Here, you can rename your anim, and split it up according to keyframes if there are multiple anims on the same object…
Now, when you drop an instance of the object into the scene, it can be played as:
animation.Play();
if the object has multiple anims, you will play them by the name (as you set it, as described above):
animation.Play("walk");
for example… (as it stands, you could say for example “animation.Play(“Take 001”);”
that would work…)
simple as that… often we want to fade between anims, so instead we use:
animation.Crossfade("nameOfAnim");
instead… check out the docs for more, such as blending and layers, etc…
Ok, so it seems to give me a console message saying "Default clip could not be found in attached animations list". What does it mean if I only have one clip in there? I am using animation.Play(); http://puu.sh/2ive5
– dendens2right below the default anim, change "size" to 1, then add the anim there too.. sorry I don't know macanim yet, there is probably a newer way to do this... apparently you must also mark the clip as "legacy" for this to work, again this will be in the import settings (on the "rig" tab)
– Seth-BergmanOk that works, but now when the animation plays, it rotates the gun and moves a different position. Then when it stops, it also stays at that position. why is that happening?
– dendens2you can change the wrapMode of the anim (in the start function): animation["reload"].wrapMode = WrapMode.Once; that should fix it...
– Seth-BergmanNo, changing the wrap mode did not help, it still changes position and rotation when I reload and stays there when it is done. Any other ideas?
– dendens2