Search Unity

NavAgent not rotating.

Discussion in 'Navigation' started by Zagaz, Jul 17, 2019.

  1. Zagaz

    Zagaz

    Joined:
    Dec 30, 2015
    Posts:
    52
    It was working properlly. The NavAgent was rotating accordinglly the tragectory. But since I placed the Animator, things went crazy. Now my agent do not rotate accordingly to its tragectory.

    What should I do?

    Thanks in advance!! ;)
     
    Last edited: Jul 17, 2019
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    382
    How have you set everything up? Usually when you make an animated agent, people will put the animated mesh in a child object and have the root object handle the NavAgent.
    It could also be that you are applying the root motion from your animations, which then conflicts with your agent. Make sure your movement is ONLY affected by the agent.

    This page details more ways to make animation and navigation play more nicely together.
     
  3. Zagaz

    Zagaz

    Joined:
    Dec 30, 2015
    Posts:
    52
     
  4. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    382
    I suppose you mean the animation for the enemy's death doesn't trigger anymore? Check the place where you fire the death event in your code and log it, see if your code actually passes through or not. It might just be that, since your animator is now on a different gameobject, your reference to the animator is broken.
     
  5. Zagaz

    Zagaz

    Joined:
    Dec 30, 2015
    Posts:
    52
  6. Zagaz

    Zagaz

    Joined:
    Dec 30, 2015
    Posts:
    52
    Thank you very kind Yandalf!!!:)