Download

Can I control audio pitch modulation via wheel rotation?

Hello,

I’m trying to build an RC-like car in Unreal Engine, one gear with a flat torque curve and instant max rpm. (Similar to how an electric engine works) Audio pitch modulation of the engine is usually tied to the RPM, since mine is either at “0” or at “MAX”. Can I use something like the wheel rotation to control the pitch?

Using the regular vehicle movement works but I want the audio pitch to react to any potential wheel spin either by loss of friction / drifting or jumping. Can I do this somehow or should I rebuild my vehicle controller and go back to using gears and a more normal torque curve?

Thank you,

If the wheel is actually spinning, then you would want to track the delta on the rotation over time.

Just get a reference to the wheel, and every frame compare its current position to the last position to find your angle of rotation, then divide that by the time since the last frame (world delta).

https://en.wikipedia.org/wiki/Angular_velocity

The only thing to keep in mind is that your sample rate of your angle checks may be too slow:

https://youtube.com/watch?v=VNftf5qLpiA
https://youtube.com/watch?v=SFbINinFsxk

So you might be better off simply detecting if the car is in the air or not rather than trying to determine if the wheels are spinning faster or slower when it goes in the air.

That is a great idea, thank you.

How about when the car is drifting or doing a “burnout”. How would you approach this situation?

You could try detecting drifting by comparing the car’s Forward Vector with the car’s Vector of travel.

Similarly, wheels spinning out could be high RPMs being registered by the car’s vehicle system but literally no forward movement.

Just get a reference to the wheel, and every frame compare its current position to the last position to find your angle of rotation, then divide that by the time since the last frame (world delta).

How do you handle rotation speeds that exceed video framerate?