November 2018
Beginner
246 pages
5h 23m
English
Boid is a term that was coined by Craig Reynold that refers to some bird-like object. We use this term to describe each individual object in our flock. Now, let's implement our boid behavior. You can find the behavior that controls each boid in our flock in the UnityFlock.cs script, which we'll examine now:
using UnityEngine; using System.Collections; public class UnityFlock : MonoBehaviour { public float minSpeed = 20.0f; public float turnSpeed = 20.0f; public float randomFreq = 20.0f; public float randomForce = 20.0f; //alignment variables public float toOriginForce = 50.0f; public float toOriginRange = 100.0f; public float gravity = 2.0f; //seperation variables public ...Read now
Unlock full access