Skip to content

1681-engine / index / cohesion

Function: cohesion() ​

ts
function cohesion(
   agent, 
   neighbours, 
   radius, 
   maxSpeed
): SteerVec;

Defined in: src/nav/steering.ts:99

Towards the middle of neighbours within radius (a flock keeping together).

Parameters ​

ParameterType
agentSteerAgent
neighboursIterable<SteerAgent>
radiusnumber
maxSpeednumber

Returns ​

SteerVec

Released under the MIT License.