- Home /
Moving Multiple Selection with Navmeshagent
I'm having a problem when calling the setDestination to all of the selected units(this objects has navmeshagent). They tend to push each other to get to the destination. I cast a ray to the position of the mouse for the destination. So basically all of my selection has only one destination. Is there a way that I can make every selected objects has different destination or there is another good way to solve this problem. Thanks
Answer by khepri · Aug 30, 2013 at 04:16 PM
I have a temporary solution for now, navmeshagent has a variable called stopping distance where the agent stop at the distance minus to the destination.
Answer by MalachiteBR · Aug 30, 2013 at 04:43 PM
I dont have unitypro to test this out, but I think it would be possible for you to reproduce the formation of your units on the destination. Center the actual formation at the mouse click and each character will have a new destination based on the actual formation.
You might have some problem if setting destination near buildings, water and other non walkable places, but that should be fixed easily.
Or another idea would be to script some behavior for the guys to let the others pass, like getting out of the way, so everybody would reach the destination some time.
Your answer
![](https://koobas.hobune.stream/wayback/20220613111122im_/https://answers.unity.com/themes/thub/images/avi.jpg)