x


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");
    }
more ▼

asked Oct 09 '10 at 04:03 PM

Martin 3 gravatar image

Martin 3
69 18 20 30

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Oct 10 '10 at 03:31 PM

Mike 3 gravatar image

Mike 3
30.5k 10 65 253

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?

Oct 10 '10 at 05:17 PM Martin 3

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?

Oct 10 '10 at 05:19 PM Martin 3

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?

Oct 10 '10 at 05:36 PM Mike 3

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?

Oct 10 '10 at 05:47 PM Martin 3
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3807
x574
x454

asked: Oct 09 '10 at 04:03 PM

Seen: 2218 times

Last Updated: Oct 10 '10 at 05:45 PM