public static void MoveUnits() { //Move & turn units for (int i = 0; i < objs.Count; i++) { Obj o = objs[i]; if (o.isUnit) { o.isMoving = false; //Debug.DrawLine(o.go.transform.position,o.goal, Color.green); //Is the unit far enough away from it's goal, that it should go there? if (Vector3.Distance(o.go.transform.position, o.goal) > o.stopDist) { Effects.DrawLine(o.go.transform.position, o.goal, 0.2f, Effects.Colors.Red); o.isMoving = true; //Slow turn at a flat rate Vector3 pos = o.go.transform.position; float tempSpd = o.spd; o.go.transform.rotation = Setup.SlowTurn(pos, o.go.transform.rotation, o.goal, o.turnSpd); //Is the unit pointing at it's goal? if (MathFuncs.CheckCone(-1, 15, o.go.transform.localEulerAngles.y, o.go.transform.position, o.goal, true)) { Effects.DrawLine(new Vector3(pos.x, pos.y + 1, pos.z), new Vector3(o.goal.x, o.goal.y + 1, o.goal.z), 0.3f, Effects.Colors.Cyan); tempSpd = o.spd; } else { //tempSpd = o.spd;// * 0.25f;//turning. Move at 1/4 speed tempSpd = 0; } o.go.transform.Translate(new Vector3(0, 0, tempSpd * Time.deltaTime)); } else { } o.textMesh.text = "isMoving: " + o.isMoving; } } }