// Update is called once per frame void Update() { car.SetSteer(Mathf.Clamp(Input.GetAxis("Horizontal"), -1, 1) * 45); car.SetThrottle(Mathf.Clamp(Input.GetAxis("Vertical"), -1, 1)); car.SetBrake((Input.GetButton("Brake") ? 1 : 0) * 100f); }
public void SetSteer(float value) { value = Mathf.Clamp(value, -45, 45); car.SetSteer(value); }