Class SC2Avoidance Extends MonoBehaviour

Public

Starcraft 2-like avoidance.

The main idea for this script is to

  • Reduce the local avoidance priority for agents that have reached their destination once.

  • Make agents stop if there is a high density of units around its destination.

'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 Variables

densityFraction
Public
reachedDestination

True if the agent has reached its destination.

Public

Private/Protected Members

agentBuffer
Private Static
AgentDensityInCircle (position, radius)
Private
ai
Private
Awake ()
Private
CheckDestination ()
Private
MaximumCirclePackingDensity
Private
prevDestination
Private
reachedCurrentDestination
Private
rvo
Private
ShouldStop ()
Private
timer1
Private
timer2
Private
Update ()
Private