Пример #1
0
        private void FixedUpdate()
        {
            steering   = Vector3.zero;
            neighbours = StoredManager.GetNeighbours(this);
            steering  += steerBh.Seek(this, target.Position);
            // steering += steerBh.Arrive(this, target.Position);
            steering += flockBh.Separation(this, neighbours) * separation;
            steering += flockBh.Alignment(this, neighbours) * alignment;
            steering += flockBh.Cohesion(this, neighbours) * cohesion;


            rigid.velocity    += steering / rigid.mass;
            transform.forward += rigid.velocity;
#if UNITY_EDITOR
            Debug.Log("steer: " + steering + " velocity: " + rigid.velocity + " max speed: " + maxSpeed * rigid.velocity.normalized);
#endif
        }