Search Unity

Games Developing Car Simulation (with demo)

Discussion in 'Projects In Progress' started by Dag-Tholander, Oct 1, 2021.

  1. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
    Hi! For the past couple of months I've been developing a custom wheel collider/vehicle physics package that has finally reached a stage where it's fun to drive and where the cars behave somewhat realistic. The tire model uses pacjeka with beckman combined slip. The simulation includs :
    * Clutch simulation
    * Downforce simulation
    * Diffrential simulation (locked, open, limited slip) with support for multiple diffrentials
    * Springs and dampers, rebound etc
    * Dynamic suspension geometry effects such as toe-in, camber.

    You can try it out and leave feedback if you'd like to. The cars and tracks are not mine and full credit for those goes to the creators. They are placeholder that have been used while working on the physics.

    Controls for the demo :
    w,a,s,d - throttle, brake and steering
    e - gear up
    q - gear down
    left ctrl - clutch
    c - switch camera
    v, b, n - orbit camera in exterior view
    esc - return to menu

    Link to demo
    https://drive.google.com/file/d/1f754dvqOj4QqAzrbr9S5i4akSTj-NdVs/view?usp=sharing
     
    Last edited: Nov 6, 2021
  2. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
    screenshot3.png
    Screenshot from HDRP test build
     
    kittik likes this.
  3. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
    New build with reworked suspension code and a new car : upload_2021-10-25_16-45-33.png
     
  4. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
  5. unity_44234FBC39E5661FBF5B

    unity_44234FBC39E5661FBF5B

    Joined:
    May 11, 2021
    Posts:
    29
    Just wondering, is it raycast based?
     
    tehmainespartan likes this.
  6. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
    Yes right now it's based on two raycasts per wheel, on the inner and outer wall of the wheel. These are then combined :)
     
  7. gs0737

    gs0737

    Joined:
    Jan 31, 2022
    Posts:
    8
    is there a webgl version?
     
  8. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
    Not right now. Are you having trouble with the demo?
     
  9. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,668
    Are those cars intented to drift?
     
  10. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
    Not really. But they are all RWD except for the aventador which is AWD, therefore they can drift. The goal is to have realistic physics
     
  11. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,668
    Thanks, i like it (i do not like the "realistic cars" that are intended to just drift -.-)
     
  12. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
    Me neither I've always prefered car games with realistic response rather than arcade style games. Glad you liked it :)
     
  13. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,765
    Very nice looking demo :) I am trying it with an XBox controller and cant seem to find an imput that does any braking, and also the car just wants to go right all the time making it impossible to drive. Do you have any deadzones set at all?
     
    Last edited: Mar 3, 2022
  14. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,668
    i thought there was a problem with my controller, so, it is the demo jaja, but with the keyboard works fine
     
  15. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
    I haven't had the possibility to try it with a controller so that's probably the issue. However the braking is tied to the vertical axis so it's wierd that your throttle works but not your braking. I'll look into it
     
  16. BinaryNinja

    BinaryNinja

    Joined:
    Mar 5, 2015
    Posts:
    5
    Looks sweet! When I saw the words "car simulation" I thought it was gonna be that basic Unity car demo again. This is...uhh...a *bit* nicer. :p
     
  17. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
    Thank you! Glad you liked it. This one should be a tad more realistic;)
     
  18. pKallv

    pKallv

    Joined:
    Mar 2, 2014
    Posts:
    1,191
    Nice. Is there any copyright on the cars?
     
  19. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
    Since I'm not earning any money by using them and also state clearly that they aren't mine, I don't think there would be any problem concerning copyright? If I'm wrong, I'll remove them.
     
    pKallv likes this.
  20. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    1,081
    Nice work. I especially like the sense of speed in the tracks. Keep working on it. Btw, how did you implement the blur effect?
     
  21. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
    Thank you! The projects been put on hold for a while since I'm busy, but I look forward to get back working on it soon. There's lots of things that can be revised and improved, especially the clutch model. The blur effect is simpy the built in one featured in the HDRP pipeline, I was very impressed with how good it looked out of the box actually. Glad you like it!
     
  22. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    1,081
    Where did you take the cars and tracks models? They are really nice
     
  23. unity_44234FBC39E5661FBF5B

    unity_44234FBC39E5661FBF5B

    Joined:
    May 11, 2021
    Posts:
    29
    I think he got the car models from sketchfab
     
  24. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    90
    Some are from sketchfab and some were extracted from Rfactor
     
  25. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,668
    Rfactor hahaa very nice game...