Recently during my internship, I was told by one of my fellow workers who graduated from University that my programming was lacking in Math Physics formulas for my vehicle movement script and that how I did it was very wrong.I don't expect a fully rewritten script, I just want to know where and what I could improve on. Maybe the coding structure, Whether how I did everything using my way is right or wrong.using System.Collections;using System.Collections.Generic;using UnityEngine;public class VehicleManagerBackUp : MonoBehaviour{    Rigidbody rb;    LogitechGSDK.DIJOYSTATE2ENGINES logitechSDK;    /* Engine sound of the vehicle */    AudioSource enginesource;    /* Get the button pressed on the wheel */    int wheelButtonPressed;    /* Engine Variables */    bool engineStartBool;    bool ranOnceEngine;    bool slowDownVehicle;    /* How long does it take to accelerate or turn? */    double momentumAccelerate;    double momentumDecelerate;    double momentumTurning;    double momentumAccelerateLimit;    double momentumBrake;    /* Maximum number of how acceleration and turning can go to */    float lengthOfBrake;    float lengthOfAcceleration;    float lengthOfTurning;    float lengthOfClutch;    /* Raw input of acceleration and turning of wheels and pedals */    float brake;    float acceleration;    float turning;    float clutchPedal;    /* slowly increases based on momentumaccelerate and momentumturning */    double accelerationTime;    double turningTime;    double momentumBrakeTime;    /* changes from cameraA to cameraB */    bool drivingPosition;    /* clutch status */    string clutch;    string previousClutch;    bool vehicleReady;    string actualClutch;    /* checks if user was from accelerate and switches to reverse without waiting for momentum end */    bool momentumEnded;    /* Rate of Momentum Multiply */    float rateOfMomentumStart;    float rateOfMomentumBrake;    /* Decreases when braking */    float lengthOfBrakingAndAcceleratingForce;    private static VehicleManager instance = null;    public static VehicleManager GetInstance()    {        return instance;    }    void Start()    {        rateOfMomentumStart = 1.01f;        rateOfMomentumBrake = 0.0005f;        clutch = Neutral;        slowDownVehicle = true;        enginesource = GetComponent<AudioSource>();        momentumAccelerateLimit = 0.0002f;        momentumAccelerate = momentumAccelerateLimit;        momentumTurning = 0.2f;        momentumBrake = rateOfMomentumBrake;        drivingPosition = true;        rb = GetComponent<Rigidbody>();        lengthOfAcceleration = 0.05f; // 0 to 0.05 Acceleration // How fast the vehicle can go        lengthOfBrake = lengthOfAcceleration;        lengthOfTurning = 20f;        lengthOfClutch = 10f;    }    void Update()    {        logitechSDK = LogitechGSDK.LogiGetStateUnity(0);        engineStart();        convertRangePosition();        switchDrivingPosition();        if (clutchPedal != 0 && accelerationTime == 0)        {            setClutch();        }        Debug.Log(rb.velocity);    }    void FixedUpdate()    {        brakingVehicle();        accelerationControl(drivingPosition);    }    void normalKeyboredControls()    {        if (Input.GetKeyDown(KeyCode.UpArrow))            acceleration = 1;        else            acceleration = 0;        if (Input.GetKeyDown(KeyCode.LeftArrow))            turning = 2;        else if (Input.GetKeyDown(KeyCode.RightArrow))            turning = -2;        if (Input.GetKeyDown(KeyCode.U))            clutch = Accelerate;        if (Input.GetKeyDown(KeyCode.I))            clutch = Neutral;        if (Input.GetKeyDown(KeyCode.O))            clutch = Reverse;    }    void engineStart()    {        if (Input.GetButton(StartEngine) || Input.GetKey(KeyCode.N))        {            if (!ranOnceEngine)            {                ranOnceEngine = true;                if (engineStartBool)                {                    /*enginesource.Stop(); */                    slowDownVehicle = true; Debug.Log(Stop);                }                else                {                    /*enginesource.Play(); */                    slowDownVehicle = false; Debug.Log(Start);                }                engineStartBool = !engineStartBool;            }        }        else        {            ranOnceEngine = false;        }    }    void setClutch()    {        if (Input.GetButton(Accelerate1) || Input.GetButton(Accelerate2) || Input.GetButton(Accelerate3) || Input.GetButton(Accelerate4))        {            if (clutch == Neutral && accelerationTime <= 0)            {                clutch = Accelerate;            }        }        else if (Input.GetButton(Reverse1) || Input.GetButton(Reverse2) || Input.GetButton(Reverse3))        {            if (clutch == Neutral && accelerationTime <= 0)            {                clutch = Reverse;            }        }        else            clutch = Neutral;    }    void convertRangePosition() // Changes 500 to -500 into 0 to 1000    {        brake = -(((logitechSDK.lRz - 32767f) / (32767f + 32767f) * lengthOfBrake));        acceleration = -(((logitechSDK.lY - 32767f) / (32767f + 32767f) * lengthOfAcceleration)); // range from 0 to lengthOfAcceleration a^2 * how long i have accelerated velocity        turning = -((((logitechSDK.lX - 32767f) / (32767f + 32767f) * lengthOfTurning)) + (lengthOfTurning / 2));        clutchPedal = -(((logitechSDK.rglSlider[0] - 32767f) / (32767f + 32767f) * lengthOfClutch));    }    //Moves the vehicle forward & stops if no acceleration is given, changes view of the camera    void accelerationControl(bool n)    {        if (accelerationTime < momentumAccelerate && acceleration == 0)        {            accelerationTime = 0;            momentumEnded = true;        }        else if (accelerationTime > acceleration || slowDownVehicle || clutch == Neutral) // Stopping        {            if (accelerationTime > 0)            {                //if (acceleration == 0)                //{                //    if (brake > 0)                //    {                //        accelerationTime -= ((momentumAccelerate * rateOfMomentumStart) + ((brake / lengthOfBrake) * 0.001));                //    }                //}                //else                //{                    accelerationTime -= ((momentumAccelerate * rateOfMomentumStart) + ((brake / lengthOfBrake) * 0.001));                //}                vehicleReady = false;            }            else            {                vehicleReady = true;            }            momentumEnded = false;        }        else if (accelerationTime < acceleration) // Drive Forward        {            accelerationTime += momentumAccelerate;            if (accelerationTime > lengthOfBrakingAndAcceleratingForce)                accelerationTime = lengthOfBrakingAndAcceleratingForce;            momentumEnded = false;        }        if (accelerationTime > 0)        {            if (n)            {                if (clutch == Reverse)                {                    driveVehicle(accelerationTime);                    previousClutch = Reverse;                }                else if (clutch == Accelerate)                {                    driveVehicle(-accelerationTime);                    previousClutch = Accelerate;                }                else if (clutch == Neutral)                {                    if (previousClutch == Accelerate)                        driveVehicle(-accelerationTime);                    else if (previousClutch == Reverse)                        driveVehicle(accelerationTime);                }                turningVehicle(drivingPosition, clutch);            }            else            {                if (clutch == Reverse)                {                    driveVehicle(-accelerationTime);                    previousClutch = Reverse;                }                else if (clutch == Accelerate)                {                    driveVehicle(accelerationTime);                    previousClutch = Accelerate;                }                else if (clutch == Neutral)                {                    if (previousClutch == Accelerate)                        driveVehicle(accelerationTime);                    else if (previousClutch == Reverse)                        driveVehicle(-accelerationTime);                }                turningVehicle(drivingPosition, clutch);            }        }    }    void driveVehicle(double value)    {        rb.MovePosition(transform.position + transform.forward * ((float)value/* / 10*/));    }    void brakingVehicle()    {        if (brake > momentumBrakeTime)            momentumBrakeTime += momentumBrake;        else            momentumBrakeTime -= momentumBrake;        if (brake > 0)        {            lengthOfBrakingAndAcceleratingForce = lengthOfAcceleration - (float)momentumBrakeTime;        }        else        {            lengthOfBrakingAndAcceleratingForce = lengthOfAcceleration;        }        //acceleration -= brake;        //if(brake > 0)        //{        //    if(acceleration > 0)        //    {        //acceleration -= brake;        //}        //else        //{        //accelerationTime        //accelerationTime -= momentumAccelerate;        //momentumAccelerate         //}        //}    }    void turningVehicle(bool n, string clutch)    {        if (n)            turningTime = (((accelerationTime * 10) * turning));        else            turningTime = -(((accelerationTime * 10) * turning));        if (n)        {            if (clutch == Accelerate)            {                var desiredRotQ = Quaternion.Euler(transform.eulerAngles.x, transform.eulerAngles.y + (float)-turningTime, transform.eulerAngles.x);                transform.rotation = Quaternion.Lerp(transform.rotation, desiredRotQ, Time.deltaTime * 10f);            }            else if (clutch == Reverse)            {                var desiredRotQ = Quaternion.Euler(transform.eulerAngles.x, transform.eulerAngles.y + (float)turningTime, transform.eulerAngles.x);                transform.rotation = Quaternion.Lerp(transform.rotation, desiredRotQ, Time.deltaTime * 10f);            }            else            {                if (previousClutch == Reverse)                {                    var desiredRotQ = Quaternion.Euler(transform.eulerAngles.x, transform.eulerAngles.y + (float)turningTime, transform.eulerAngles.x);                    transform.rotation = Quaternion.Lerp(transform.rotation, desiredRotQ, Time.deltaTime * 10f);                }                else                {                    var desiredRotQ = Quaternion.Euler(transform.eulerAngles.x, transform.eulerAngles.y + (float)-turningTime, transform.eulerAngles.x);                    transform.rotation = Quaternion.Lerp(transform.rotation, desiredRotQ, Time.deltaTime * 10f);                }            }        }        else        {            if (clutch == Accelerate)            {                var desiredRotQ = Quaternion.Euler(transform.eulerAngles.x, transform.eulerAngles.y + (float)turningTime, transform.eulerAngles.x);                transform.rotation = Quaternion.Lerp(transform.rotation, desiredRotQ, Time.deltaTime * 10f);            }            else if (clutch == Reverse)            {                var desiredRotQ = Quaternion.Euler(transform.eulerAngles.x, transform.eulerAngles.y + (float)-turningTime, transform.eulerAngles.x);                transform.rotation = Quaternion.Lerp(transform.rotation, desiredRotQ, Time.deltaTime * 10f);            }            else            {                if (previousClutch == Reverse)                {                    var desiredRotQ = Quaternion.Euler(transform.eulerAngles.x, transform.eulerAngles.y + (float)-turningTime, transform.eulerAngles.x);                    transform.rotation = Quaternion.Lerp(transform.rotation, desiredRotQ, Time.deltaTime * 10f);                }                else                {                    var desiredRotQ = Quaternion.Euler(transform.eulerAngles.x, transform.eulerAngles.y + (float)turningTime, transform.eulerAngles.x);                    transform.rotation = Quaternion.Lerp(transform.rotation, desiredRotQ, Time.deltaTime * 10f);                }            }        }    }    //Changes the position of the driving position    void switchDrivingPosition()    {        if (Input.GetKeyDown(KeyCode.M) && accelerationTime <= 0)        {            drivingPosition = !drivingPosition;        }        if (drivingPosition) // A is active        {            LoadManager.GetInstance().vehicleCamera[1].SetActive(true);            LoadManager.GetInstance().vehicleCamera[0].SetActive(false);        }        else // B is active        {            LoadManager.GetInstance().vehicleCamera[0].SetActive(true);            LoadManager.GetInstance().vehicleCamera[1].SetActive(false);        }    }}
Physics formulas for vehicle movement
c#;unity3d;physics