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

Multiple NavMeshAgent moving to the same point

Discussion in 'Getting Started' started by DEV971, Oct 11, 2018.

  1. DEV971

    DEV971

    Joined:
    Oct 25, 2017
    Posts:
    26
    The typical RTS where you select multiple units and make them move to an arbitrary point.
    How do you avoid them colliding each other once they get close enough?
    I've been playing around with Rigidbody properties but no luck.
     
  2. Green11001

    Green11001

    Joined:
    Apr 14, 2018
    Posts:
    397
    Edit the layer collisions in edit > project settings > Physics/Physics2D
     
  3. DEV971

    DEV971

    Joined:
    Oct 25, 2017
    Posts:
    26
    Hey thanks, if I understand correctly what you say is I must assign the units to let's say a layer "Units" and then there tick the checkboxes like this?



    Not sure if that's how it is supposed to be but tried it and it doesn't work, they are still colliding/bouncing each other
     
  4. Green11001

    Green11001

    Joined:
    Apr 14, 2018
    Posts:
    397
  5. Green11001

    Green11001

    Joined:
    Apr 14, 2018
    Posts:
    397
    thats the documentation for that
     
  6. DEV971

    DEV971

    Joined:
    Oct 25, 2017
    Posts:
    26
  7. Green11001

    Green11001

    Joined:
    Apr 14, 2018
    Posts:
    397
  8. Green11001

    Green11001

    Joined:
    Apr 14, 2018
    Posts:
    397
    well then im not sure
     
  9. DEV971

    DEV971

    Joined:
    Oct 25, 2017
    Posts:
    26
    anyone else?
     
  10. Green11001

    Green11001

    Joined:
    Apr 14, 2018
    Posts:
    397
    actually there is another way
     
  11. Green11001

    Green11001

    Joined:
    Apr 14, 2018
    Posts:
    397
  12. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Most RTS games cheat. When you assign a bunch of units to move, they don't all get assigned to the same position. Instead they get assigned to a bunch of positions around that point. Which means that they don't clump and collide.

    The other option is to turn off collisions between them and just let them all move to the same position.