im in to boids right now and steering behaviours and im triyng to make the separation between boids but i cant get the code to work can someone plz help with this ?
static public Vector3 separation(GameObject boid, float maxseparation, float separationradius)
{
Vector3 force = new Vector3();
float SEPARATION_RADIUS = separationradius;
float MAX_SEPARATION = maxseparation;
int neighborCount = 0;
List<Enemy1> boids;
boids = new List<Enemy1>();
for (int i = 0; i < boids.Count; i++)
{
Enemy1 b = boids*;*
if (b.skin != boid && Vector3.Distance(b.skin.transform.position, boid.transform.position) <= SEPARATION_RADIUS)
{
force.x += b.skin.transform.position.x - boid.transform.position.x;
force.y += b.skin.transform.position.y - boid.transform.position.y;
neighborCount++;
}
}
if (neighborCount != 0)
{
force.x /= neighborCount;
force.y /= neighborCount;
force = force * -1;
}
force.Normalize();
force = force * MAX_SEPARATION;
return force;
}