/// <summary> /// Calculate remaining steering force and return false if no more can /// be added. Return true if still remaining force that can be added. /// </summary> private bool AccumulateForce(Vector2 forceToAdd) { // Get steering force remaining double remainingStrength = Agent.MaxForce - SteeringForce.Length(); // Max exceeed add nothing and return false to stop steering computation if (remainingStrength <= 0) { return(false); } // We can add new steering force as it if (forceToAdd.Length() < remainingStrength) { SteeringForce += forceToAdd; } // We can add new steering force but we need to limit it else { SteeringForce += Vector2.Multiply(Vector2.Normalize(forceToAdd), (float)remainingStrength); } return(true); }