Search Unity

Navmesh agent fuse together in crowded situation

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

  1. JackMeOut

    JackMeOut

    Joined:
    Nov 2, 2015
    Posts:
    1
    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;
    3.  
    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;
    3.  
    4. public class AgentMovement : MonoBehaviour {
    5.     public Vector3 Destination;
    6.     NavMeshAgent Agent;
    7.  
    8.     // Use this for initialization
    9.     void Start () {
    10.         Agent = GetComponent<NavMeshAgent> ();
    11.     }
    12.    
    13.     // Update is called once per frame
    14.     void Update () {
    15.         Agent.SetDestination (Destination);
    16.     }
    17. }
    18.  
    I'm also pretty aware of the collider and rigidbody effect as stated in http://forum.unity3d.com/threads/need-advice-or-recommendations-with-navmesh-and-agents.130012/
    Since I need to detect collision between agent and based on http://docs.unity3d.com/Manual/CollidersOverview.html 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