Distance between the bot and its target
Forum rules
To request support/assistance for MFPS, you first have to verify your purchase by sending your purchase invoice number to Lovatto in a PM.
To request support/assistance for MFPS, you first have to verify your purchase by sending your purchase invoice number to Lovatto in a PM.
- Leonid_RU
- Contributor
- Posts: 57
- Joined: Tue Sep 11, 2018 3:04 am
Hello. Tell me how you can make sure that the bots do not come close to each other, but that they stay at some distance. That is, to make the minimum distance that they can't get close to their goal. If you can tell me where to change this in the script, I will be very grateful.
- Lovatto
- Admin
- Posts: 1834
- Joined: Sun Dec 07, 2014 3:18 pm
- Contact:
Hi,
That is more complicated of what it sounds,
You can set the stop distance between the AI agent and its target with Agent.stoppingDistance
but that doesn't solve the problem that you mentioned 'to bots do not come close to each other', for that you have to make sure each bot is aware of all other bots positions if it's close enough -> search another destination.
so that means you have to calculate the distance of each bot with all the other bots regularly and create an algorithm to search alternative paths.
There's no code that I could point you at because this implementation has to be done from scratch.
That is more complicated of what it sounds,
You can set the stop distance between the AI agent and its target with Agent.stoppingDistance
but that doesn't solve the problem that you mentioned 'to bots do not come close to each other', for that you have to make sure each bot is aware of all other bots positions if it's close enough -> search another destination.
so that means you have to calculate the distance of each bot with all the other bots regularly and create an algorithm to search alternative paths.
There's no code that I could point you at because this implementation has to be done from scratch.
- InCodeWeTrust
- Contributor
- Posts: 18
- Joined: Wed Mar 27, 2019 10:05 am
bl_AIMananger.cs script holds the reference to all the players and the bots. You could use that to start with and then write some avoidence code like suggested above with stopping distance to be double if its a bot on the same team for example.Leonid_RU wrote: ↑Fri Jul 10, 2020 12:04 am Hello. Tell me how you can make sure that the bots do not come close to each other, but that they stay at some distance. That is, to make the minimum distance that they can't get close to their goal. If you can tell me where to change this in the script, I will be very grateful.
- InCodeWeTrust
- Contributor
- Posts: 18
- Joined: Wed Mar 27, 2019 10:05 am
InCodeWeTrust wrote: ↑Thu Jul 16, 2020 7:09 pmbl_AIMananger.cs script holds the reference to all the players and the bots. You could use that to start with and then write some avoidence code like suggested above with stopping distance to be double if its a bot on the same team for example. Then like every 5 ticks or something have the bot update its position to a list that you can check against or a OnTrigger dome around the bot that if another bot enters it triggers this and causes one or the other to move elsewhere.Leonid_RU wrote: ↑Fri Jul 10, 2020 12:04 am Hello. Tell me how you can make sure that the bots do not come close to each other, but that they stay at some distance. That is, to make the minimum distance that they can't get close to their goal. If you can tell me where to change this in the script, I will be very grateful.