Search Unity

Resolved Root Motion Issue with Animation

Discussion in 'Animation' started by JungaBoon, Oct 25, 2020.

  1. JungaBoon

    JungaBoon

    Joined:
    Aug 4, 2020
    Posts:
    18
    In Unity3D. ver 2020.1.7

    So I have a basic cube that I want to jump towards the Player.

    I created a jumping animation that has the cube physically moving up and forward. I also applied a Rigidbody component to the cube. There is a script that makes the cube always look at the Player.

    I tried applying Root Motion in the cube's Animator component. It moved the cube forward (seemingly a lot more than I actually animated it to do so) but it would also flip over and lose orientation, beginning to jump wildly all over the place. I then tried disabling the Rigidbody. The animation then plays relatively fine, but now the cube just keeps stopping higher and higher above the Player whenever it jumps.

    I've seen around some forums that there is supposed to be a panel in the Inspector that shows this:


    But when I click the animation of the cube, I only have this:
    upload_2020-10-25_10-53-24.png

    I would like to bake the Y transform of the animation as a purely visual thing so that it doesn't mess with the object's physics when moving towards the player.

    The animation is made entirely in Unity, and all of the guides I've seen involve premade animations from Mixamo or Blender. I would appreciate any help. I've just been trying to get a simple jumping enemy AI working these last couple of days, and I can't seem to find any documentation on it. Thanks.
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    The first image is the Model Importer which you get when you select an FBX asset (imported from places like Mixamo or Blender). The bottom one is just an AnimationClip and as far as I know there's no way to use the Model Importer without having a model file.

    You might be able to export the animation as an FBX using the FBX Exporter package then reimport it.
     
  3. JungaBoon

    JungaBoon

    Joined:
    Aug 4, 2020
    Posts:
    18
    I managed to get something working decently well. I put my object in an Empty GameObject and put the Animator on that. Then whenever I needed the object to jump, I use the Empty for the XZ movement and the parented Object as the Y movement. The result is a visual jump that I can control via animation. Which works for what I need it to.