Search Unity

Animation newbie problem

Discussion in 'Editor & General Support' started by PolyMad, Oct 4, 2010.

  1. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Well had no problems until now in exporting meshes from Max but now I need animation. It's the first time for me to use this on Unity and I'm having some problems.
    I have this prefab (you can download it) and there should be exported also animations and bones but when I try some command about play it says there is no anim in the object.
    So, is this exported well and I don't know how to call anims or anims are not exported for some reason? I can't know that!

    There's some anim in the first 6 frames.
     

    Attached Files:

    Last edited: Oct 4, 2010
  2. Paulius-Liekis

    Paulius-Liekis

    Joined:
    Aug 31, 2009
    Posts:
    672
    Everything works fine for me.

    Maybe there is no default animation assigned in your object? Just try reimporting your object again and drop it into scene and see if it works.
     
  3. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Thank you for help Paulius!
    How do you activate the animation? I tried a couple of commands like

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class AnimPlay : MonoBehaviour {
    5.  
    6.     // Use this for initialization
    7.     void Start () {
    8.    
    9.     }
    10.    
    11.     // Update is called once per frame
    12.     void Update () {
    13.     animation.Play("all", PlayMode.StopAll);
    14.     }
    15. }
    16.  
    But it keeps telling me that there is no anim clip with that name ("all"), but I defined it in the mesh import settings!
     
    Last edited: Oct 5, 2010
  4. Paulius-Liekis

    Paulius-Liekis

    Joined:
    Aug 31, 2009
    Posts:
    672
    Just select your object (in the scene view) and find Animation component. It has animations listed under Animations. You can play any of the listed animations. By default animation is called "Take 001". Try playing that.
     
  5. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Nothing... there must be something I do wrong but I can't really find out what it is.
    Here I enclose the imported hand, can you tell me what's wrong? The animation clips are there!
    Also, in the scene, I selected anim clip ALL or SCHICCHERA, and the hand is horizontal in editor, when I launch the game the hand turno down on one side by 90 degrees...
     

    Attached Files:

  6. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Sorry for boring all the forum but I really can't come out of this... I attached a couple of -mov to show what the anim looks like in Max and what happens in Unity.

    The anim is only in the first 7 frames, I don't need smooth anims but only some hand positions and little more, at least for now.

    Thank you.



    Well I wanted to upload but even if files are just two rar of less than 6 MB it doesn't allow... so I put them in DropBox and here are the links:

    http://dl.dropbox.com/u/858716/unityhelp/IMG_0031.rar

    http://dl.dropbox.com/u/858716/unityhelp/IMG_0032.rar
     
  7. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Bumping it up... sorry guys, this should be really easy to spot for experienced users... what is wrong in here? Or is it a bug with Unity3?
     
  8. Vicenti

    Vicenti

    Joined:
    Feb 10, 2010
    Posts:
    664
    Animations store rotation and position. You need to make the hand a child of a different gameObject, and use that gameObject to control the hand's position/rotation.

    Your hand-spazzing-out problem is because when you play the animation it plays disjointed frames one right after the other. You need to set animation["clip"].speed = 0.0, then set animation["clip"].time = the exact time of whichever frame you're using.
     
  9. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Thank you for help Vicenti, but at the moment I'm just using the PLAY AUTOMATICALLY checkbox in the hand object.
    That should at least show me the SCHICC clip that I defined in the mesh import parameters... but the result really is totally different from what I have set up in Max.
    Even if the hand is rotated by 90 degrees, that wouldn't be a problem, the problem is that the bones are not matching my anim at all.

    Isn't PLAY AUTOMATICALLY supposed to play the anim I selected in the ANIMATION field at the right rate?
    If so, why it's not working?

    I also changed bones in the QUALITY setting from 2 to 4 just to be sure that it wasn't a problem of not enough interpolation but nothing changed.
     
    Last edited: Oct 9, 2010
  10. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Bump again...
     
  11. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    HI
    Could you mail me your Max file?
     
  12. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350