Cool! Problem is that I don't use Wheel Colliders with my car. It's basically a cube with arcade car controls.

I already got the engine sound implemented, it's just a matter of getting the pitch right to mimic the shifting.

If you don't have actual gear shifts you can mimic the sound by mapping the pitch to a graph of a function of speed. I made an example where

*pitch = speed*gear_ratio/k*, where

*gear_ratio* is a number between 1 and 0, where first gear has a ratio of 1 and each new gear has a smaller number. For example:

*1st gear = 1, 2nd gear = 0.6, 3rd gear = 0.4, 4th gear = 0.3, 5th gear = 0.2.*
The constant

*k* is the max speed of first gear, in this case I set

*k = 45* because I want first gear to achieve a maximum speed of 45.

I suppose the easiest way to do this would be to have a condition that says something like (in pseudo code):

*if speed > k/0.2: gear_ratio = 0 *(this would give no engine sound if the speed is greater than the top speed of the car)

*else if speed > k/0.3: gear_ratio = 0.2*

else if speed > k/0.4: gear_ratio = 0.3

else if speed > k/0.6: gear_ratio = 0.4

else if speed > k/1: gear_ratio = 0.6

else if speed > 0: gear_ratio = 1

else: gear_ratio = -1 (this would be a reverse gear)
Then calculate:

*engine_pitch = speed*gear_ratio/k*
It will probably sound a bit strange when you're right at the shifting point, so if you want you could implement a special shift sound that plays just when you pass the shifting point, to mask the jump in pitch. You could do that by storing the gear ratio from the previous physics tic and checking if it's the same as you have in the current tic:

*if gear_ratio is not equal to old_gear_ratio: play shift sound*

old_gear_ratio = gear_ratio (this is to save the current gear ratio to the next physics tic)

The volume of the engine sound I'd set to equal

*(pitch+throttle)/2*, so the volume would be the greatest when you're at max revs and on the throttle. Alternatively you could add weights to each component so that you can decide how much each aspect will influence the volume:

*volume = (w1*pitch+w2*throttle)/(w1+w2)*
where w1 and w2 are the weights (which you can set to basically any number greater than zero). Perhaps you want the throttle to have a bigger impact on volume than the pitch has, for example.

Of course, once you have all this you can basically use the same method to implement actual gear shifts too