Search Unity

Convert root motion to Nav Mesh Agent speed

Discussion in 'Animation' started by Griffo, Sep 25, 2014.

  1. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi,

    I have an enemy that uses root motion, and has a nav mesh agent, how would I covert the root motion to nav mesh agent speed?

    Is it possible? Or should I be doing it another way?

    Thanks.
     
  2. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Can you give us more detail what you would like to achieve?

    We do have a demo showing an integration with nav mesh and animator. The character is following a path computed by the nav mesh. Basically we do it the other way around. The nav mesh provide a desired speed and direction that we feed to the controller.

    Take a look at Mecanim example scenes on the asset store and open scene Nav Mesh Example.
    https://www.assetstore.unity3d.com/en/#!/content/5328
     
    Griffo likes this.
  3. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Thanks for the reply, I wanted the enemy to use its root motion for movement because it looks more realistic, but I've always used non root motion because up until now all my animated characters had no root motion so I use a nav mesh agent, setting it's destination to the player when the player gets within a set distance, then with trial and error I'd set the nav agent speed by watching the character and fine tuning it's speed until it matched the walk/run animations.

    You say "The nav mesh provide a desired speed and direction that we feed to the controller" I thought it would be the other way around, the animation root motion speed/velocity would dictate the nav mesh agents speed, so the speed matched the walk/run animation stride?

    I'm new to root motion so maybe I'm missing something ..

    Thanks.
     
    howong likes this.