Search Unity

Navmesh Inconsistent based on Angle

Discussion in 'Navigation' started by enkidorado, Nov 20, 2021.

  1. enkidorado

    enkidorado

    Joined:
    Jun 28, 2020
    Posts:
    2
    Hi there. I'm currently having an issue where my agent is being very picky about when it wants to approach its target.

    Ex:

    You can see that the agent is receiving the destination but refusing to walk further when I make her walk to the corner and she still flips direction to "look" at the other sprite. So far I've set the pivot point of the sprites to bottom center so they're accurately showing the characters on the ground. Their agents and collision boxes are accurate to what you see here.

    As of right now the only code touching this interaction is
    Code (CSharp):
    1.     private void ChaseTarget()
    2.     {
    3.         this.agent.SetDestination(selectedTarget.transform.position);
    4.         Debug.Log(selectedTarget.transform.position);
    5.         Debug.Log("Destination");
    6.         Debug.Log(agent.destination);
    7.     }
    The debugs are obviously there to help me determine if the agent's destination is properly set to the position of the target, which it is.

    So far, I'm dumbstruck. If any other information can help figure this out I'm happy to provide it.
     
  2. enkidorado

    enkidorado

    Joined:
    Jun 28, 2020
    Posts:
    2
    So then, I managed to solve this. It seems like it was simply down to my navmesh agent's radius being too small. I'm still now sure how that caused an issue only at particular angles, but by making the navmesh agent's radius just a bit larger I was able to start moving the sprite where I want it without issue.