T- Type of vector, either 2D or 3D, implementing the
public interface Proximity<T extends com.badlogic.gdx.math.Vector<T>>
Proximitydefines an area that is used by group behaviors to find and process the owner's neighbors.
Typically (but not necessarily) different group behaviors share the same
Proximity for a given owner. This allows you to
combine group behaviors so as to get a more complex behavior also known as emergent behavior. Emergent behavior is behavior
that looks complex and/or purposeful to the observer but is actually derived spontaneously from fairly simple rules. The
lower-level agents following the rules have no idea of the bigger picture; they are only aware of themselves and maybe a few of
their neighbors. A typical example of emergence is flocking behavior which is a combination of three group behaviors:
cohesion. The three behaviors are typically
combined through a
blended steering. This works okay but, because of the limited view distance of a
character, it's possible for an agent to become isolated from its flock. If this happens, it will just sit still and do
nothing. To prevent this from happening, you usually add in the
wander behavior too. This way, all the agents
keep moving all the time. Tweaking the magnitudes of each of the contributing behaviors will give you different effects such as
shoals of fish, loose swirling flocks of birds, or bustling close-knit herds of sheep.
Before a steering acceleration can be calculated for a combination of group behaviors, the neighbors must be determined and
processed. This is done by the
findNeighbors(com.badlogic.gdx.ai.steer.Proximity.ProximityCallback<T>) method and its callback argument.
Proximityinstance among group behaviors having the same owner can save a little time determining the neighbors only once from inside the
Proximityimplementation classes can check the
frameIdin order to calculate neighbors only once per frame.
falsefrom the method
|Modifier and Type||Interface and Description|
The callback object used by a proximity to report the owner's neighbor.
|Modifier and Type||Method and Description|
Finds the agents that are within the immediate area of the owner.
Returns the owner of this proximity.
Sets the owner of this proximity.