Here is code
using UnityEngine;
public class CarMovement : MonoBehaviour
{
[SerializeField] _wheels = new Rigidbody[4];
int _torqueMultiplier = 10;
int _multiplierForAcceleration = 150;
float _horizontal, _vertical;
bool _leftShift;
// everything rendering and input related goes here
void Update ()
{
_vertical = Input.GetAxis("Vertical");
_horizontal = Input.GetAxis("Horizontal");
_leftShift = Input.GetKey(KeyCode.LeftShift);
}
// everything physics and simulation related goes here
void FixedUpdate ()
{
float torque = _torqueMultiplier;
Vector3 right = new Vector3(0,_horizontal);
_wheels[0].AddTorque( right * torque );
_wheels[1].AddTorque( right * torque );
if( _leftShift ) torque = _multiplierForAcceleration;
Vector3 forward = new Vector3(_vertical,0);
foreach( Rigidbody wheel in _wheels )
{
wheel.AddTorque( forward * torque );
}
}
}