Skip to content

1681-engine / index / separation

Function: separation() ​

ts
function separation(
   agent, 
   neighbours, 
   radius, 
   strength
): SteerVec;

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

Away from neighbours closer than radius px, harder the closer they are: bodies of a crowd stop stacking on one tile. A neighbour exactly on top is pushed off along a direction picked from the pair's places, so two bodies spawned on one spot still part.

Parameters ​

ParameterType
agentSteerAgent
neighboursIterable<SteerAgent>
radiusnumber
strengthnumber

Returns ​

SteerVec

Released under the MIT License.