Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Open Sourced (Free) car physics engine for Unity3D lite - YouTube video included!

Discussion in 'Made With Unity' started by Majatek, Apr 18, 2011.

  1. Majatek

    Majatek

    Joined:
    Apr 17, 2011
    Posts:
    19
    Unity3D version: 3.3 - Lite License
    Download: http://www.sendspace.com/file/qute4x
    (250mb~ file - Unity3D source file inside)

    *UPDATED*
    • Physics now reflects real-life gearing
    • Visible tachometer fluctuates with the RPM and gears, seen behind the steering wheel
    • Fixed a major memory leak where I was drawing multiple car bodies (there was a huge car model underneath the gameworld - gone now) polys at runtime is halved!





    Old video of what the physics engine was (Is now more reliable, and has a tachometer - not visible in this video of the old version):


    Why did I release this? Well, I only recently found this great multimedia package, and saw how many are newcomers to scripting and object coding - I've seen many posts asking for "how to rotate the steering wheel", or "why is my car jumping so high?". Well, I decided to do a bit of internet scrounging, found a nice little physics tutorial by some person (wow, I already forgot his name - Will edit this post when I find the tut again), and decided to write it anew into the Unity3D's car tutorial, which has lovely terrain. It's also due to the fact that most of the Unity3D users don't have the pro license, or any way of buying assets out of the asset store (It holds true for me, too).
    And the McLaren? Ah, that's just one of my favourite car makes. In order for me to create it, I had to split the mesh into two parts - One for the steering wheel, and the other for the rest. From there it was a simple texture-selecting process that took about 15 minutes.
    All in all, it took me 3-4 days of following a tutorial, and applying the changes to the other tutorial that contained the terrain that I wanted.

    It includes:
    • Steering wheel turns according to user input
    • "Rollable" car (due to physics of course)
    • Some basic sound effects (the motor)
    • Camera switching system

    And please guys, if you're going to use this - Replace the McLaren with your own car.

    RESOURCES:
    Here's the website that I got the McLaren off of: http://archive3d.net/
    Here's the blog that I got the tut off of: http://www.gotow.net/andrew/blog/?page_id=78
    The car physics was originally scripted by Andrew.
    I hope you can put this to good use :)
    Also, if you find any glitches, please notify me - I'd like to make it as usable by others as possible.

    Keyboard controls (sorry for not posting them!)
    Up down left right = Movement
    1 2 3 4 (Not the numpad numbers) = Camera control
    No reset button yet (Ran out of time) - If you flip the car, you'll need to Alt+F4 and restart the application.
     
    Last edited: Apr 19, 2011
  2. handsomePATT

    handsomePATT

    Joined:
    Nov 30, 2010
    Posts:
    574
    looks good!
     
  3. Majatek

    Majatek

    Joined:
    Apr 17, 2011
    Posts:
    19
    Yeah, thanks - Just as a word of warning for those who're going to jump straight into this, the actual car model (along with the steering wheel) is attatched to the "carphysics" body. This is done so that the interpolation of the Rigid Body fixed joint doesn't cause any jittering.

    I'll be working on this further down the track, optimizing it and such so that child objects work with their parents and etc, but for now this is practically useable by any newcomer to Unity3D. Well, at least I hope so.
     
  4. handsomePATT

    handsomePATT

    Joined:
    Nov 30, 2010
    Posts:
    574
    Did you use your own car script or is it a modified one from the Car Tutorial?
     
  5. liverolA

    liverolA

    Joined:
    Feb 10, 2009
    Posts:
    347
    would you please upload this on another file server? can't download..
     
  6. Majatek

    Majatek

    Joined:
    Apr 17, 2011
    Posts:
    19
    Half-half - After all, I've only just started in Unity3D.
    But what was done by him (that I didn't do) I did extensively edit.

    *edit*
    Oh, so I see DropBox isn't completely compatible with everyone - That's a shame. Well I'll upload a Host-A.net mirror tomorrow because I've just about used up my bandwidth for today.
    Sorry for any inconveniences, I'll get the link up asap tomorrow.

    All links are down for the moment, please bear with me D:
     
    Last edited: Apr 19, 2011
  7. Majatek

    Majatek

    Joined:
    Apr 17, 2011
    Posts:
    19
    Filehost problem resolved! Updated functions! We can download the file again! =D

    Unity3D version: 3.3 - Lite License
    Download: http://www.sendspace.com/file/qute4x
    (250mb file - Unity3D source file inside)

    *UPDATED*
    • Physics now reflects real-life gearing
    • Visible tachometer fluctuates with the RPM and gears, seen behind the steering wheel
    • Fixed a major memory leak where I was drawing multiple car bodies (there was a huge car model underneath the gameworld - gone now) total polys at runtime is halved!
     
  8. Thunderent

    Thunderent

    Pocket Artist

    Joined:
    Oct 8, 2010
    Posts:
    435
    Thanks Majatek!
    This will help me and the community a lot!

    Keep us updated.
     
  9. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    CRAZY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Thanks a lot.

    6R
     
  10. Adrenaline-Crew

    Adrenaline-Crew

    Joined:
    Dec 14, 2010
    Posts:
    400
    If u can figure outhow to do it with motorcycles I will let u have my girlfriend
     
  11. Digital

    Digital

    Joined:
    Feb 6, 2011
    Posts:
    182
    This is great, but I think that the suspensions are too soft and the car should drift more, I have a feeling that the car has too much grip.
     
  12. Route 66 Rambler

    Route 66 Rambler

    Joined:
    Mar 12, 2010
    Posts:
    45
    Is the name you're trying to remember Andrew Gotow? I remember learning quite a bit from his tutorials before, especially the helicopter one...
     
  13. zine92

    zine92

    Joined:
    Nov 13, 2010
    Posts:
    1,347
    downloading it now. looks nice
     
  14. Pedro Afonso

    Pedro Afonso

    Joined:
    Mar 13, 2011
    Posts:
    240
    hi!
    this looks awesome, I'm downloading it right now.

    One more thing, the website from where you have take the McLaren models says that all the models can be used in commercial products (games, etz.) but isn't there any problem with the car's companies?
     
  15. Pedro Afonso

    Pedro Afonso

    Joined:
    Mar 13, 2011
    Posts:
    240
    So, I have downloaded your project but it doesn't work (the scene is all pink and doesn't work) is it only for 2.6 or works with unity 3.2 Pro?

    Other thing, as I'm creating a commercial game I would like to know if the models of that site are really available to use, or if I'm gonna have troubles with the cars' companies?
     
  16. SobhanNina

    SobhanNina

    Joined:
    Mar 15, 2010
    Posts:
    42
    This is Version 2 yes ? well when will you release Version 3 ?

    *UPDATED*


    did you mean we can see the gears number ?? if yes i can not see the gears number !! but if it is not any , well i think it will be a good feature to add !

    Encountered a problem !!! :

    Dear Majatek when i hit the play button and then switch to inside camera to see the steering wheel , i see something funny happens!!! it seems the "Steering Wheel" detaches from the car and stays on the air and seems to be freeze in its position and not functional !!!!
    here is the screen shot :
    http://www.irupload.ir/images/aqax29z5sz6nofobh1to.png

    please help me with that and am waiting for your replay's dear friend
     
  17. gharaibeh

    gharaibeh

    Joined:
    Apr 26, 2011
    Posts:
    115
    it is the same of car tutorial which came with unity !!
    loool
     
  18. Roylen

    Roylen

    Joined:
    Jan 22, 2012
    Posts:
    24
    Hey Majatek, this project is cool but the car seems to have too much grip, it does not even drift. Could you(or anyone else) point out where should i modify the code to make it drift?
     
  19. frankyboy450

    frankyboy450

    Joined:
    Jan 21, 2011
    Posts:
    106
    please help me.
    i opened your project.
    made everything to a package.
    opened my project.
    added the stuff from the package.
    everything works fine expect the gears.
    the car can't get past first gear.
     
  20. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    950
    Can you put it on a decent server? Willing to mirror for you, but an hour of downloading for a 250MB file?
     
  21. javanoob

    javanoob

    Joined:
    Aug 15, 2012
    Posts:
    64
    How do you make the car follow A I waypoints please ,does that work here ?
     
  22. KareemErgawy

    KareemErgawy

    Joined:
    Jan 11, 2013
    Posts:
    8
    Thanks a lot for the effort but the server is so bad. Would you please upload it somewhere else?
     
  23. KareemErgawy

    KareemErgawy

    Joined:
    Jan 11, 2013
    Posts:
    8
  24. Muhannad_Taslaq

    Muhannad_Taslaq

    Joined:
    Mar 26, 2013
    Posts:
    19
    great ... thanks :) how is this better than other tools ?
     
  25. vinzzzunity

    vinzzzunity

    Joined:
    Apr 18, 2013
    Posts:
    19
    it's better to upload it to somewhere with resumeable dl for guests, like mediafire, but this exceeds the size limit 200mb
     
  26. frogsbo

    frogsbo

    Joined:
    Jan 16, 2014
    Posts:
    79
    I wish i could download this online!
     
  27. frogsbo

    frogsbo

    Joined:
    Jan 16, 2014
    Posts:
    79
    i didnt manage to get this file, but i found another one by whizzkit hosted on unityprefabs

    simple car (buggy)

    it has many errors i should maybe post updated version, it's about 3 4 years old. to make it run i had to ad about 20 var words to the old scrip and change all the accelerate brake left right to horizontal vertical axes and i took away the reverse.
     
    Last edited: Feb 1, 2014