Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Animations not playing properly and at 45°???

Discussion in 'Animation' started by ElMagnifico, Sep 12, 2020.

  1. ElMagnifico

    ElMagnifico

    Joined:
    Aug 27, 2018
    Posts:
    71
    I have not one, but several issues:

    1. animation rotation and looping

    First attempt, using a Mixamo rig and animations, dropped because I cannot edit mixamo animations and he RootMotion setting in them:




    This is my second attempt, using a new custom rig and animations made in Blender. Normal walk cycle, there is no rotation in the animation. Yet for some reason, not only is the character at a 45° for some reason, bu his walk animation is not playing (but the AI in the background does play the walk cycle. Still at 45° for some reason)




    AS you can see here in blender, character is looking forward while walking.


    But it's at a 45° angle when I look the animation in Unity????

    2. melee attack
    The second issue is melee attack animation. It is set in a new animation layer with an avatar mask, that so only upper body is affected (the animation is a rifle butt swing). It is activated by a trigger, but for some reason it is always on and it doesn't loop, character is stuck in end frame. Wiedrly enough, even when I specifically dissallow it's trigger, it was still active. I had to delete the layer.
    Even stranger, the reload is set up exactly the same as melee, and it works without issues.


     
    Last edited: Sep 12, 2020
  2. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    1. unity as default takes hip as root transform, and because in the animation starts with hip 45`R, it is rotated.
    add [in the root transform rotation:] orientation offset 45 (and usually good practice to bake too.)



    2. try looping the animation
    or might be the case if anim doesn't play on base layer
    or use full-body rigs, one base layer (that way blend-trees are a possibility) and for performance reasons too
     
  3. ElMagnifico

    ElMagnifico

    Joined:
    Aug 27, 2018
    Posts:
    71
    Yep, offset fix it.

    Looping still doesnt' work.

    My PlayerMovementController is sending this in the Fixed Update:
    animator.SetFloat("speed", (FacingSide() * rigidBC.velocity.z) / sneakSpeed);

    and this is used to trigger the transition to walk anim, which is set to loop:
    https://i.postimg.cc/qMc80B5y/loop.jpg