/// <summary> /// /// </summary> public void LateUpdate() { if (!HasLeader) { return; } if (!Leader.IsStopped) { StoppedThisFrame = false; Agent.SetDestination(Leader.GetFormationPosition(PositionIndex, LookAhead)); Agent.speed = NavAgentDefaultSpeed * AgentGroupSpeedModifier; } else { //one last destination set, this time without compensation if (!StoppedThisFrame) { Agent.SetDestination(Leader.GetFormationPosition(PositionIndex, 0)); StoppedThisFrame = true; } //TODO: //we need to do a sample here and see if it's possible to even get to our destination //without fighting over it with another agent. } }