November 2018
Beginner
246 pages
5h 23m
English
This FlockController is similar to the one in the previous example. In addition to controlling the flock's speed and position, this script also instantiates the boids at runtime:
using UnityEngine; using System.Collections; using System.Collections.Generic; public class FlockController : MonoBehaviour { public float minVelocity = 1; //Min Velocity public float maxVelocity = 8; //Max Flock speed public int flockSize = 20; //Number of flocks in the group //How far the boids should stick to the center (the more //weight stick closer to the center) public float centerWeight = 1; public float velocityWeight = 1; //Alignment behavior //How far each boid should be separated ...Read now
Unlock full access