A few years ago, I wrote a tutorial which described how to write a simple car racing game in the Unity game engine. I’ve re-uploaded this tutorial here so that others can use it.
I discourage the use of this tutorial, as it was written years ago, and much of the information provided is now inaccurate, and may no longer hold true. Readers should take the information within with a grain of salt.
HI Andrew, the way the car tutorial is described by you is pretty awesome. However, i’d like to say that the drop box link is broken and i’m not able to download the package. Can you please share it again. Thanks !!
I apologize for the inconvenience. The link should be fixed now!
Thanks, it works. Just a question, If I want the car to auto accelerate, should I just replace the “Input.GetAxis(“Vertical”)” parameter with 1 ?
Yes, that will do the trick! Although you may want to do some ramping on the input so it’s not so immediate, otherwise the wheels may slip and the depending on your setup.
Hi Andrew, have you tried your car in Unity version 5 yet? It may need a few tweaks, I’d love to hear your suggestions.
I opened the tutorial project, and indeed the newer version of PhysX included in Unity5 broke most of the demo. Thanks for the heads up! I am currently working on an complete re-write of the tutorial, so stay tuned!
EDIT:
One thing I’d suggest in the meantime is re-creating the wheel colliders and looking at the default values it provides, just to get a feel for the ranges the values should use. The default spring force on the wheel colliders is now 35000, rather than 5 or 10, so re-creating your rig might be necessary.
One of things I noticed in the other car physics packages is that they are not using unity’s inbuilt wheel colliders, instead they have made their own by using a sphere collider and raycasts.
Yeah I noticed that as well. I feel as though the in-built Wheel Colliders are a little harder to configure, so getting something specific is a little trickier, but require significantly less work than a roll-your-own solution. I wrote my own wheel collider system a while back for a different project, but I think it depends on the project.
i can’t download this project file. how to download this ? please help
Thanks for bringing this to my attention! There was a problem with the Google Driver permissions, but it should be fixed now 🙂
Hi! Does it work for unity 5 I have several errors when I try to play it! Thanks
Unity Technologies made some changes to the scripting API between Unity 4, and Unity 5, so the project may not run immediately. The changes are relatively minor, but after a few tweaks, it should work.
Hi Andrew,
Is there any chance you could try making the changes and upload a new version? I’ve tried making the changes without success. It’s such a great project, it’s simple yet powerful with the waypoint AI etc. Happy to contribute some $$ if needed. Cheers
No need, Jeff! I’ve updated the project, and it should be working in Unity 5. I’m glad I could help!