I’m very excited to announce that the Demo Team has recently released a car tutorial in collaboration with our friends at Unity Studios.
For those who were at Unite ’09, this is the racing game that was demoed when showcasing the new profiler in Unity 2.6 during the keynote. The aim of this tutorial is to show you how to create a racing game with Unity. In it, we assemble a car from a 3d model, scripts and Components. The tutorial provides you with a complete project of a driving game, where you can play with a finished scene and explore how everything is put together. We also provide you with a scene that has everything ready but the car, which you will then work on completing.
Section 1 – Assembling the Car
The first section of the tutorial provides details about assembling a Car Prefab from a 3D model, scripts and components. We discuss the basics required to setup the car, including adding collision, shadow settings for the car and skid marks. Upon completing this part of the tutorial, you should have a working knowledge of the Scene and a fully functional driving demo.
Section 2 – Tweaking the Car
“Tweaking the Car”, discusses various aspects of the car’s configuration. In this section, you will learn how to tweak the car to behave “better” or in different ways. The goal of this section is to provide a more thorough understanding of the car setup to allow for customization.
Section 3 – Under the Hood
For those adventurous souls looking to fully customize their ride, the third section of the tutorial digs deep into the scripts that power the car prefab. Here you will find an in-depth assessment of most of the major functions and a walk-through of the actual code that drives the car.
As a bonus, thanks to Unity physics guru and car aficionado, Jonas Echterhoff, we have provided an alternate high-end physically accurate and realistic car model. The simulation does not make use of Unity’s wheel colliders, but instead implements its own wheel collider in script based on Physics.Raycast. The model then uses a Pacejka “Magic Formula”- based tire model to calculate wheel forces to apply to the car, which gives more accurate results.
Download the tutorial and take it for a spin. See you on the open road.