using System.Collections; using System.Collections.Generic; using UnityEngine; public class CarController : MonoBehaviour { public float speed = 20f; public float turnSpeed = 50f; public float boostMultiplier = 2f; private float moveInput; private float turnInput; void Update() { // Get player input moveInput = Input.GetAxis("Vertical") * speed * Time.deltaTime; turnInput = Input.GetAxis("Horizontal") * turnSpeed * Time.deltaTime; // Move car forward/backward transform.Translate(0, 0, moveInput); // Rotate car transform.Rotate(0, turnInput, 0); // Nitro Boost (Shift Key for PC, Mobile UI Button Needed) if (Input.GetKey(KeyCode.LeftShift)) { transform.Translate(0, 0, moveInput * boostMultiplier); } } }