A* Pathfinding Project
4.1.10
The A* Pathfinding Project for Unity 3D
|
Starcraft 2-like avoidance. More...
Starcraft 2-like avoidance.
The main idea for this script is to
'High density' is defined as: Take the circle with the center at the AI's destination and a radius such that the AI's current position is touching its border. Let 'A' be the area of that circle. Further let 'a' be the total area of all individual agents inside that circle. The agent should stop if a > A*0.6 or something like that. I.e if the agents inside the circle cover over 60% of the surface of the circle. The 60% figure can be modified.
Public Attributes | |
float | densityFraction = 0.5f |
Properties | |
bool | reachedDestination [get] |
True if the agent has reached its destination. More... | |
Private Member Functions | |
float | AgentDensityInCircle (Vector2 position, float radius) |
void | Awake () |
void | CheckDestination () |
bool | ShouldStop () |
void | Update () |
Private Attributes | |
IAstarAI | ai |
const float | MaximumCirclePackingDensity = 0.9069f |
See https://en.wikipedia.org/wiki/Circle_packing. More... | |
Vector3 | prevDestination |
bool | reachedCurrentDestination |
RVOController | rvo |
float | timer1 = 0 |
float | timer2 = 0 |
Static Private Attributes | |
static List< IAgent > | agentBuffer = new List<IAgent>() |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
float densityFraction = 0.5f |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
get |
True if the agent has reached its destination.
If the agents destination changes this will return false until a new path has been calculated. Note that changing the destination every frame may cause this value to never return true.
True will be returned if the agent has stopped due to being close enough to the destination. This may be quite some distance away if there are many other agents around the destination.