Search Unity

Unexpected Navmesh agent rotation

Discussion in 'Navigation' started by CottonKy, Aug 9, 2019.

  1. CottonKy

    CottonKy

    Joined:
    Apr 28, 2019
    Posts:
    5
    Hi all,

    I am having some question regarding Navmesh. I am using Navmesh to achieve RTS like unit movement. To enable unit walk around other units, I set them to obstacle when stationary and set them to agent when moving. It is generally working, however, I have some issues observed and I don't know why or I don't know if it can be solved with Navmesh.

    When A and B walking toward each other: If A and B is not facing each other, they will try to steer in a weird way and move like gif below, rather than they steer and run directly to the center of these two unit.

    https://imgur.com/D4hTaPx
    (Sorry Idk how to put a gif here)

    Notes on how I implemented my Navmesh agent:
    1. Because when stationary, a unit is an obstacle, I set the Navmesh destination point to be like below, otherwise, it will trigger obstacle avoidance unnecessarily.
    2. To avoid stucking and target a position is not walkable, I implemented an destination sampling. Consider the target is standing next to some other unit, and both unit is stationary, I will try to sample other points on the edge on unit size radius circle as check if that position is emply and walkable. If it is, it will try to walk to that empty position.

    3. Here is my agent settings


    If anyone knows the answer to my issue, that would be great and I am very appreciated! If anyone know other thirdparty asset (i.e. good packge in unity asset store) that work perfectly with their RTS unit movement, let me know as well.

    Thanks!