I made a vehicle demo, with the vehicle wrapper. Since some of you may be planning to make your own car game I thought it would be good to show how I would do it.
The demo will be updated when new features are added. My final intension is to create a blend with several vehicles on a hidden layer, that can be loaded and added to a scene. The player then can walk to a vehicle and drive it, park, go to another vehicle … Also I hope to add a menu to change controls. But that’s for later.
Controllers (keyboard and gamepad) can be edited in the ‘controllers.py’ script. Vehicle templates can be added and edited in the ‘vehicles.py’ script. The game properties of the vehicle object (in this case ‘Car’) hold references to the vehicle template and the names of the vehicles body, tires, steering wheel and cameras, and the lights of the scene. When the script starts the lights will be parented to a vertex child of the vehicle, and the car default camera will be set to the active camera.
In order to understand the script you have to know what classes and modules (can) do and you have to know about dictionaries, lists, matrices, vectors, radians, …
For better turning control the demo is best played with a game pad with stick.
The audio files are public but may not be sold.
I hope this will be helpful to some of you.
Edit_1:- small fix (was moving forward while braking)
Edit_2:- fix when upside down (skid);- fix when turning on local X-axis (crash);
- fix when turning on local Z-axis (gear);
- impact dependent volume of crash
Edit_3: to do: lights; interior
Vehicle_demo.zip (402 KB)