Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NavMeshAgent & Root Motion

Discussion in 'Scripting' started by GBeats, Sep 19, 2014.

  1. GBeats

    GBeats

    Joined:
    May 22, 2014
    Posts:
    4
    Hi sorry if this is in the wrong place........

    Im currently playing with ideas and im trying to setup a point and click movement system using the NavMesh and NavMeshAgent, now its working fine apart from the odd time where the agent goes walking all over the place, anyway, I was trying to work out how I would get some animations playing to sync with the Agent and couldn't really see a clean way of doing it without passing values back and forth changing velocities in realtime and blending animations in some weird way.

    I googled this for a couple of hours and didn't find much, some ideas of not allowing the Agent to control the movement etc. so I followed this idea and came up with a sort of work around, but I haven't tested this yet but would like some opinions and advice.

    If I setup the Agent to purely act as a pathfinder and then using the 'NavMeshAgent.NextPosition' I can assume this is a direct line to the next waypoint and use another script to get the heading and send my character there using root motion. once I arrive there I then use 'NavMeshAgent.Warp()' to send the agent to this position and then hopefully it will automatically get the next waypoint to the destination. And then I repeat this until its arrived at its destination........

    I think this should work but isn't there a better way to do this?

    Thanks.....