Example #1
0
    // 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);
    }
Example #2
0
 public void SetThrottle(float value)
 {
     value = Mathf.Clamp(value, -100, 100);
     car.SetThrottle(value / 100.0f);
 }