SKIP TO PARAGRAPH 3 IF YOU KNOW HOW A TURBO WORKS!
A turbo, works like this: you have a turbine and a compressor which are connected. The exhaust gases spin the turbine, thus spinning the compressor. The compressor, well, compresses the air, sends it to an intercooler and then trough the throttle body to the engine, thus creating a better air/fuel mixture and increasing the power output.
The problem is that when you don’t push the gas pedal there is not much air going into the engine and it doesn’t create a lot of exhaust gas and it barely spins the turbine, if it spins it at all. When you put your foot down, obviously more fuel is burned and more exhaust gas is generated, but the turbo cannot spool up that fast to give you power instantly, here is the lag. Generally the older the car tho worse the turbo lag is.
So, how can I do it? I’m not really good a programing yet, I just started.
The wheels are driven by torque. I thought about having 2 torque values, one for the naturally aspirated engine and one for what the turbo adds, but I can’t apply instantly that much torque, because, especially in corners, the car would spin it’s wheels and eventually spin out. A better idea is to increase from the NA engine torque to the max torque in a limited time.
So, I basically need something that gradually increases the torque from x to y in z amount of time.