This is Unity source code. Perfect for your android or iOS racing game.
This asset will provide you with virtual steering wheel that is very easy to setup and use.
How to use it?
– Drag and drop “steering wheel.prefab“ from “Prefab” folder into you canvas
– Inside your scripts call SteeringWheel.axis static variable to get steering wheel input axis.
As simple as that!
- “Max Angle” option will determine how much steering wheel can rotate. For example if you put “540” that will allows steering wheel to rotate anywhere between 540 and -540 degree.
- “Return Value” determine maximum value which script will return when steering wheel reaches value of “Max Angle” variable. For example if you put “540” in “Max Angle” option and “1” in “Return Value” option – when you rotate steering wheel to 540 degree “SteeringWheel.axis” static variable will return 1 and If you rotate to -540, “SteeringWheel.axis” will return -1.
- “Spin Back To Center” if checked steering wheel will return to 0 degree position once you release input from your steering wheel.
- “Spin Back To Center Position Speed” – works only if “Spin Back To Center” is checked. This option determine speed at which steering wheel will return back to 0 degree position.