Search Unity

Animation in play game mode doubles the distance

Discussion in 'Animation' started by DojoArcade, Oct 31, 2017.

  1. DojoArcade

    DojoArcade

    Joined:
    Jan 22, 2015
    Posts:
    10
    We are currently animating some animal prefabs created in qubicle with no rigs, the animation is being applied directly to the meshes separate grouped components under a empty game object, legs, body head etc.
    A walk cycle has been created but when root motion is applied for the position of the animals animation to move it forward, the animation plays correctly in the animation tab but when the play button for the game mode is applied the animation is played but the transform distance is doubled.
    Has anybody else had similar issues and does anybody know how to resolve this please? any help would be greatly appreciated.
     
  2. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    did you created the whole animation into unity?
     
  3. DojoArcade

    DojoArcade

    Joined:
    Jan 22, 2015
    Posts:
    10
    Yes all created in unity, thanks for the response
     
  4. DojoArcade

    DojoArcade

    Joined:
    Jan 22, 2015
    Posts:
    10
    im applying the root motion to the top parent which was the empty group object, for example sheep
     
  5. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    So the body of the animal is not transformed (moved) in the animation - only the master/root game object?
     
  6. DojoArcade

    DojoArcade

    Joined:
    Jan 22, 2015
    Posts:
    10
    it is moved but only secondary animation, it has nothing to do with the top parent node (game object) moving forwards over distance/ the body is a separate object under the top node and has no forward motion applied in the animation.
     
  7. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Unfortunatelly this is a know issue and we are working on a fix.

    The problem is the sampling function used to keyframe by the animation window, it doesn't apply the root motion. So when you keyframe any animation for position, rotation, and scale since the root motion is not applyied the local matrix for the keyframed transform is not correctly computed and you get a double transform when you go inplay mode.

    There is a workaround explain in this thread but it not an easy one and may not work in your case depending on how your rig is build
    https://forum.unity.com/threads/hit...lem-in-imported-root-motion-animation.485524/
     
    theANMATOR2b likes this.