Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Feedback Custom car physics solution

Discussion in 'Works In Progress' started by Dag-Tholander, Dec 9, 2019.

  1. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    64
    Last couple of weeks I've been working on a car physics project. It uses pacejka 94 formulas for longitudal, lateral, aligning forces and uses the beckman method for combined forces.

    Since I've seen quite a few threads on here struggling with writing their own custom wheelcollider I'm open to sharing the source code once I've commented everything and cleaned up the code a bit in exchange for feedback. I've linked a downloadable demo below. (The track and the engine sounds were NOT created by me, they were exported from rfactor and belongs to their respective creators).

    Link :
    https://drive.google.com/file/d/1KdZmjbohySpYChOR850wC3w7S-f2nOfP/view?usp=sharing

    Controls :
    W, up arrow - throttle
    S, down arrow - brakes
    D, A, right arrow, left arrow - steering
    E - shift up
    Q - shift down
    C - switch camera

    UI :
    Guage show RPM / 100
    Current gear is displayed on the left side of the guage.
    Green box shows throttle
    Red box shows brakes
    Blue box shows clutch, but it isn't implemented yet.

    If you have any questions or suggestions I'd be more than happy to answer them!

    BTW beware of the chicane

    01.jpg
     
    Last edited: Dec 9, 2019
    AskCarol likes this.
  2. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    943
    That's a great start, any chance of an external camera, I find it much easier to judge the physics if I can see what the car is doing.
     
  3. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    64
  4. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    64
    The suspension model has been replaced. It can now simulate dynamic camber, dynamic toe in, and ackerman. I'm also working on a custom gizmos for the wheel editor :
    02.jpg
     
  5. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    64
    I'm working on a day/night cycle system which currently (quite poorly) fakes scattering and has support for dynamic clouds etc. I've also been working a lot on physics. There's also a new build availible for those who want to try it : https://drive.google.com/file/d/1aAxJLhvEOdNiaIowFeAH0IEYKxi9R-bo/view?usp=sharing

    Controls :
    W, up arrow - throttle
    S, down arrow - brakes
    D, A, right arrow, left arrow - steering
    E - shift up
    Q - shift down
    C - switch camera


    03.jpg 04.jpg 05.jpg
     
    VermilionGames likes this.
  6. VermilionGames

    VermilionGames

    Joined:
    Jun 12, 2015
    Posts:
    14
    The physics is pretty great, good work. Waiting for the future updates
     
unityunity