private void FixedUpdate() { if (_unit) { if (!_unit.IsAlive) { return; } } _steering.Compute(); // Apply Steering and truncate to max speed _velocity = Vector3.ClampMagnitude(_velocity + _steering.Velocity, _maxSpeed); _rotation = GetOrientationFromDirection(_velocity); // Update velocity and rotation transform.position += _velocity * Time.deltaTime; transform.eulerAngles = Vector3.up * _rotation; _steering.ResetForces(); }