- Home /
Unity3d Starcraft 2 Model animation
Hi! At first I'd like to say that I'm very new to Unity, so maybe my following question is stupid, but I hope you all can help me with it! :)
I have a problem with animation playing in Unity3d. I have downloaded a starcraft 2 model (Not blizzards model, but from someone, who made that model for starcraft 2 editor). The model is in a .m3 format. I learned how to open it in 3ds Max, and export it to another file. I choose to export it to .3ds format. Then I imported it to Unity, and it looks perfect. Now the problem is that the all the animations like shooting, running etc. is only in one file "Take001" instead of one file per animation. Now I dont know how to make unity to know when the Character should run and when to shoot. I cant animate, so I dont know anything aobut it, so is there a way of solving the problem, or is there a better way of doing all these steps?
I hope you can help me! :)
edit: In 3ds Max, you can view all the animations. there are about 15.
edit 2 : So, I somehow found out that animations are stored in one file, and that they can be separated in Unity, but how?
Script: the idea with this script is that it plays walk animation when the object is moving along the z axis, it play T_right (turn right) animation when not moving, but rotating, and to make it play stand animation when not moving or rotating
// Animations
if(moveDirection.z != 0) { animation.CrossFade("walk"); }
if(rotation.y != 0 && moveDirection.z == 0)
{
animation.CrossFade("T_right");
}
if(moveDirection.z == 0 && rotation.y == 0)
{
animation.CrossFade("Stand");
}
Hey man, I know this post is quite old, but I'm trying to do a similar thing. Can you tell me how you managed to export the model (including textures & animations) and import it in Unity? Thanks a bunch!
"quite old"... it's been almost six years! :D
I'd be surprised if there wasn't a multitude of tools and plugins to import a SC2 model with animations and materials into $$anonymous$$ax. Once it's there, you can easily export it to FBX.
There are some, but most are unfortunately outdated and can't be used anymore since a major internal SC data overhaul less than a year ago... :c
Answer by Mike 3 · Oct 10, 2010 at 03:31 PM
In unity, expand the model and click the Take001 animation - it should bring up the animation import inspector.
What you need to do is click the split toggle, and then type in the name, start and end frames for each animation in the grid below it.
You can most likely figure out the names and frames from the model in 3dsmax.
Ah. Thanks a lot! I though none was going to answer this question anymore. Now I seem to have this problem that my model only want to play the first animation - run. Even that I make it "idle" in the script, its just still stuck on the run animation. Why?
And second problem is that when I run, the run animation runs fine, but every time the animation have played, it makes a little pause, where the character animation freezes, and then It begins again. How to make it not make that pause?
For the second problem, it could be the frame numbers are off slightly - unity uses 0 for the first frame, check if 3dsmax uses 1 or 0. For the first problem, not really sure, could you put the script into your question?
Posted the part of the script now. The animation pause problem is still there. I tried to change the start of the animation "walk" from 0 to 1, but it still makes that pause. Can it be that I left something unchecked?