Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Navmesh agent fuse together in crowded situation

Discussion in 'Navigation' started by JackMeOut, Nov 12, 2015.

  1. JackMeOut


    Nov 2, 2015
    Hi to All and thanks for even looking. more thankfully to those who helped me

    I'm trying to make crowded crossroad to make scene of pedestrian group crossing the crossroad by following one guide for each group. First what I have done is creating a simple scene using capsule object to as navmeshagent as you can see from my video:

    The problem is, if you see at 0:46 the agent fused and pop out in this very crowded crossroad.
    The destination of pedestrian agent is their respective leader while the leader itself have determined destination. The code for pedestrian can be seen below:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    4. public class FollowerAgentMovement : MonoBehaviour {
    5. [HideInInspector]public Transform NPCLeader;
    6. NavMeshAgent Agent;
    7. void Start () {
    8. Agent = GetComponent<NavMeshAgent> ();
    9. NPCLeader = GameObject.FindWithTag ("LeaderAgent");// each group have different leader in the implementation there are 2 tag LeaderA and LeaderB
    10. }
    11. void Update () {
    12. Agent.SetDestination (NPCLeader.position);
    13. }
    14. }
    And this the code for the guide(leader)
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    4. public class AgentMovement : MonoBehaviour {
    5.     public Vector3 Destination;
    6.     NavMeshAgent Agent;
    8.     // Use this for initialization
    9.     void Start () {
    10.         Agent = GetComponent<NavMeshAgent> ();
    11.     }
    13.     // Update is called once per frame
    14.     void Update () {
    15.         Agent.SetDestination (Destination);
    16.     }
    17. }
    I'm also pretty aware of the collider and rigidbody effect as stated in
    Since I need to detect collision between agent and based on the collision action matrix of Kinematic Rigidbody Collider cannot trigger the OnCollisionEnter function so I keep using nonkinematic collider as child of the capsule with rotation and position constrain for the rigidbody to detect the collision and the force didn't affect the navmeshagent component. I also tried removing the rigidbody so it's only the nevmesh component that affecting the agent but the fuse problem still exist. Can someone help me why this phenomenon happen?
    Note: sorry for my bad english