Documentation
    Preparing search index...

    Function cohesion

    • Cohesion (§12 flocking): steer toward the centroid of the neighbours.

      centroid = (Σ neighbour.position) / count
      result   = seek(centroid)
      

      Literally Reynolds' definition — cohesion is seek, aimed at the average position — so a straggler accelerates at maxAcceleration toward the middle of its flock. With no neighbours there is no centroid and the result is the zero vector (see separation on abstention).

      Parameters

      Returns Vector3