void FixedUpdate() { Vector3 accel = wander.getSteering(); steeringBasics.steer(accel); steeringBasics.lookWhereYoureGoing(); }
// Update is called once per frame void Update() { Vector3 accel = colAvoid.getSteering(colAvoidSensor.targets); if (accel.magnitude < 0.005f) { accel = wander.getSteering(); } steeringBasics.steer(accel); steeringBasics.lookWhereYoureGoing(); }
virtual protected Vector3 getDirection(Vector3 accel) { if (nearSensor.targets.Count > 0) //If collision { accel = collision.getSteering(nearSensor.targets); //Steer away } if (accel.magnitude < 0.005f) //If not moving fast enough, pick somewhere { accel = wander.getSteering(); } return(accel); }
void FixedUpdate() { Vector3 accel = Vector3.zero; accel += cohesion.getSteering(sensor.targets) * cohesionWeight; accel += separation.getSteering(sensor.targets) * separationWeight; accel += velocityMatch.getSteering(sensor.targets) * velocityMatchWeight; if (accel.magnitude < 0.005f) { accel = wander.getSteering(); } steeringBasics.steer(accel); steeringBasics.lookWhereYoureGoing(); }
void FixedUpdate() { Vector3 accel = colAvoid.getSteering(colAvoidSensor.targets); if (accel.magnitude < 0.005f) { accel = wander.getSteering(); } else { Debug.DrawLine(transform.position, transform.position + accel.normalized, Color.red, 0f, false); } steeringBasics.steer(accel); steeringBasics.lookWhereYoureGoing(); }