Vector3 rule2(boidspawn bj)
    {
        Vector3 Distancing = Vector3.zero;

        foreach (boidspawn item in boids)
        {
            Distancing += Vector3.Normalize(bj.Position - item.model.transform.position) / Mathf.Pow(SocialDistance, 2) / DistanceStep;
        }
        return(Distancing * DistanceWeight);
    }
    void Start()
    {
        //Time.timeScale = 0.1f;

        boids = new boidspawn[boidCount];
        for (int i = 0; i < boidCount; i++)
        {
            boids[i] = new boidspawn(GameObject.CreatePrimitive(PrimitiveType.Cube), this);
            // boids[i].model = GameObject.CreatePrimitive(PrimitiveType.Cube);
            boids[i].model.GetComponent <Renderer>().material.color = Color.red;
        }
    }
    Vector3 rule3(boidspawn bj)
    {
        Vector3 PrecievedVelocity = Vector3.zero;

        for (int i = 0; i < boids.Length; i++)
        {
            if (boids[i].model != bj.model)
            {
                PrecievedVelocity += boids[i].Velocity;
            }
        }
        PrecievedVelocity /= boids.Length - 1; //calculate average velocity
        // Debug.Log(PrecievedVelocity);
        return(PrecievedVelocity - bj.Velocity / AlignmentWeight);
    }