private void FixedUpdate() { if (boat != null) { if (canReachSail) { if (displayInfo) { InterfaceController.DisplayText("Hold \"e\" to set sail, hold \"q\" to lower sail", 5); displayInfo = false; } boat.ChangeSailsFor(Input.GetAxis("SetSail") * Time.deltaTime * 0.4f); } if (canReachRudder) { Vector3 toRudderVector = boat.rudder.transform.position - transform.position; toRudderVector.y = 0; Vector3 moveDirection = movement.LookDiretionInput; moveDirection.y = 0; float angle = Vector3.Angle(moveDirection, toRudderVector); if (angle < 90) { float minSpareVelocity = 0.5f; float velocityLossFromAngle = 1 - ((Mathf.InverseLerp(0, 90, angle) * minSpareVelocity)); boat.rudder.ChangeRudderRotation(movement.LookDiretionInput.magnitude * -boat.rudder.AngleSignOfTheSailorRelativeToTheRudder(transform.position) * velocityLossFromAngle * rudderTurnSpeed); } } } }