Distance between the bot and its target

Support for MFPS 2.0
Post Reply
User avatar
Leonid_RU
Contributor
Contributor
Posts: 56
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.
User avatar
Lovatto
Admin
Admin
Posts: 1778
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.
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
InCodeWeTrust
Contributor
Contributor
Posts: 18
Joined: Wed Mar 27, 2019 10:05 am

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.
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.
User avatar
InCodeWeTrust
Contributor
Contributor
Posts: 18
Joined: Wed Mar 27, 2019 10:05 am

InCodeWeTrust wrote: Thu Jul 16, 2020 7:09 pm
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.
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. 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.
Post Reply