Search Unity

Animation from maya... having troubles

Discussion in 'Scripting' started by Mr. Animator, Oct 2, 2005.

  1. Mr. Animator

    Mr. Animator

    Joined:
    Oct 2, 2005
    Posts:
    193
    I just discovered Unity today, and promptly blew the whole day doing tutorials and poking around the manual and forums. This software looks amazing, but I haven't found any particularly clear explainations for how one would actually import multiple animations from maya for the same character. I know that you have to save each clip as its own maya file, but I'm not sure how the naming is supposed to work. The manual makes reference to calling them something like monster@walk.fbx, monster@run.fbx... but what about when they're still maya files? Should I call them monster@walk.mb? An idiot-proof walkthrough would help a lot for those of us without motion builder.

    I have a feeling this is why I've been unable to play any animations. I've been trying with a simple cylinder with three joints in it, but not having any luck (aside from getting it to play once by default when I test the game.) I can't even get an object to play its default animation more than once, let alone a clip from another maya file. I've been trying to get this simple bit to work:

    Code (csharp):
    1. function Update () {
    2.    if (Input.GetKeyDown ("x")) {
    3.         animation.Play(AnimationPlayMode.Queue);
    4.    }
    5. }
    Shouldn't that play my cylinder's default animation when I hit "x"? I have a feeling I'm missing something totally fundamental, but its getting late and my brain's starting to hurt. Thanks in advance!
     
  2. Richard_B

    Richard_B

    Joined:
    Jul 22, 2005
    Posts:
    436
  3. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Most likely you attached the script to the wrong object in the scene.

    Make sure that the object you are attaching the script to actually has an animation clip assigned to the "Animation" property.
    (Make sure it does NOT say "None (AnimationClip)");

    When there are multiple objects in one scene in maya and you import them into Unity, Unity will place a dummy object around them to group the scene.
    The animation clip will not be attached to the dummy game object but the children of it. (Which are the roots in the maya scene)

    --- Here is how to import and play back multiple animations.

    1. Import a couple of mb/fbx files using the "monster@run.mb" naming scheme
    2. Instantiate one of them in the scene using drag and drop
    3. Select the game object that you have animated. Make sure it actually has an animation clip assigned.
    4. Drag the animation clips from the different mb/fbx files onto the selected game object. This will add the clips to the animation component and you can now play them back using the name you gave them using the "monster@run.mb" naming scheme.
     
  4. Mr. Animator

    Mr. Animator

    Joined:
    Oct 2, 2005
    Posts:
    193
    Thanks very much for the prompt and thorough response. That certainly seemed to work. I think I had tried doing that before, but I was putting the animation clips and the script on the skin of my maya object and not the root joint.

    You guys certainly do a great job supporting your users. I'm pretty sure i'll be registering my copy of Unity in the near future, if only to support uncommonly cool software. Keep on rockin'