Package net.citizensnpcs.api.ai.flocking
Class CohesionBehavior
java.lang.Object
net.citizensnpcs.api.ai.flocking.CohesionBehavior
- All Implemented Interfaces:
FlockBehavior
Implements cohesion flocking with a particular weight i.e. steering a flock of NPCs towards each other.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetVector
(NPC npc, Collection<NPC> nearby) Returns the displacement vector to be combined with otherFlockBehavior
vectors by aFlocker
.
-
Constructor Details
-
CohesionBehavior
public CohesionBehavior(double weight)
-
-
Method Details
-
getVector
Description copied from interface:FlockBehavior
Returns the displacement vector to be combined with otherFlockBehavior
vectors by aFlocker
.- Specified by:
getVector
in interfaceFlockBehavior
- Parameters:
nearby
- the set of NPCs to consider for flocking purposes- Returns:
- the displacement
Vector
-