void Update() { Vector3 _direction = (nextPoint - transform.position).normalized; Quaternion _lookRotation = Quaternion.LookRotation(_direction); _lookRotation = Quaternion.Euler(0, _lookRotation.eulerAngles.y, 0); float r = fixAngle(_lookRotation.eulerAngles.y - fixAngle(transform.rotation.eulerAngles.y)); if (control.speed < nextNode.maxSpeed) { control.inputMotor = 1f; } else { control.inputMotor = 0f; } if (Mathf.Abs(r) < 10) { control.inputSteer = maxSteer(r / 15f); } else { control.inputSteer = maxSteer(r); } if (nextNode.checkDistance(new Vector2(transform.position.x, transform.position.z))) { nextPointID = worldpath.getNextID(nextPointID); nextPoint = worldpath.getNextPointByID(nextPointID); nextNode = worldpath.getNodeByID(nextPointID); } //Debug.Log(control.aiInputSteer + " " + r); }