Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. 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

My Drifting simulation project

Discussion in 'Made With Unity' started by Ravel, Dec 8, 2011.

  1. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    Update! 11.05.2012
    A massive update from the previous version:

    http://sideways.dezine.net.ee/

    So today i made some gagues in photoshop from scratch and i decided to add few more features with those features my results were mind blowing for myself so i thought Id showcase my current progress of my car simulation project (mainly aimed for drifting but can handle any car).

    Features:
    (+ featured, - not yet featured)
    Current setup is a quite stock mustang with a engine of:
    278.2rwhp@5800 281.6ft-lb@4400 (source Pop Hotrod 1.355)
    Since the car has no TCS and the differential is Vicious Lsd, the car tends to naturally drift because of the powerful engine.
    But to make the car a drift beast, try this setup for a start in the telemetry togle:
    Torque X 2
    Springs F 90 R 70
    Camber F -4
    Steering 58
    Height 0.24

    ..oh yeah 1,2,3 change cameras.

    Also a G25 steering wheel is featured, but there is no force feedback at the moment so the result might not be that satisfying.

    The author of the car is Stecki.
    The ebisu track is property of EA and used as a place holder for this demonstration version.
     
    Last edited: May 11, 2012
  2. andorov

    andorov

    Joined:
    Feb 10, 2011
    Posts:
    1,061
    I think the settings are a little out of control, you can barely go in a straight line, sideways or otherwise :p
     
    Last edited: Dec 8, 2011
  3. GameReady3D

    GameReady3D

    Joined:
    May 19, 2011
    Posts:
    90
    pretty cool...but hard to control. Try putting more tire grip. The steering rate might be too fast. Overall, it's a great start...keep it up.
     
  4. Gherid_lacksGPS

    Gherid_lacksGPS

    Joined:
    Dec 3, 2011
    Posts:
    111
    It's really cool seeing something like this. But yeah, the controls are a bit finicky. Drifting isn't about power but suspension set up and weight transfer. Maybe tone down whatever governs your torque a bit. I couldn't even set up properly for a Scandinavian flick.

    Most drifting oriented physics that i have seen, seem to have, at least in some fashion, "padded" or "fluff" constraints on your entry and exit angle - like, once you get past a particular angle, it becomes exponentially harder to over correct and lose your line. Yet, once you pass through that "padded" threshold constraint, you lose control and need to correct. It's weird, but it seems to work well.

    Something like this seems to be entirely skill based and doesn't depend on angle and control helpers. There aren't any padded angle constraints and as such, weight distributions and transfer control is really important.

    However, it's really nice seeing car physics with counter steer. Looking forward to seeing this develop.

    Edit: Also, sorting out manual gear change wold help, too. Being able to enter the corner and shift down into the proper rpm/torque range would help control a bit. Enter the corner in a higher gear with less torque, then shift down.
     
    Last edited: Dec 9, 2011
  5. MooseMouse

    MooseMouse

    Joined:
    Sep 14, 2011
    Posts:
    516
    It is a nice start. I like the counter-steering aspect. But right now it drives more like a hover-craft than a car. The grip is way too low.
     
  6. gtpdzbiz

    gtpdzbiz

    Joined:
    Mar 21, 2011
    Posts:
    53
    Hmmm....carlswood?
     
  7. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    Carlswood yup.

    Thanks for the comments. To be honest i have been working on it for quite some time. Hmm about the "padded" or "fluff" constraints, could you tell me some more information, Gherid_lacksGPS ?

    My current tire simulation is based on pacejka tire formula with beckmans combined slip. Only thing that im currenty not doing "right" is that the maximum slip, are constant, but they should be dynamic.

    The steering rate is high, because of the keyboard input, its hard to controll if the steering rate is low (low sensitivity) and is not enjoyable, as it is with this unrealistic steering.

    As for the tires pacejka curves, I have added a slipery tire for easyer drifting. Mostly it gets slipery when the turbo kicks in.
     
  8. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    Update, did some massive rewriting in my car dynamics scripts. Tell me what you think?
     
  9. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    .. then again the car is not that powerfull to drift, i accidentally added the engine braking factor a bit to high... but hey you can e-brake it the corners anyway...
     
  10. tatelax

    tatelax

    Joined:
    Feb 4, 2010
    Posts:
    1,147
    Incredible!
     
  11. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    402
    It needs some additional work, but it's a nice start.

    Are you planning to sell your Vehicle Physics in the Asset Store?
    If so, I would be interested in adding support for your Vehicle Physics in my Racing AI package...
     
  12. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    I'm not yet sure what im going to do with it, I'm simply just writing a car simulation for fun, because i sort of like vehicle physics and am trying to understand how a car is done with mathematical values etc.

    But if this project goes well and people will like the handling, i might write something for the asset store...

    But for now just for fun, anyway it would be nice if people would note out what they like and what they think should be fixed?
    I personally think that the clutch is acting weirdly (bu tbetter than nothing haha)
     
  13. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    402
    Ok, I understand. I would like to support every Vehicle Physics available for Unity3D, so if you finally decide to start selling your vehicle simulation, let me know and we can work together to make my product compatible with your code.
     
  14. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    I found it quite fun.>>> nice project.
     
  15. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,101
    Its cool, but way too hard I think. If what your trying to do is just make a super realistic simulation, for yourself, or a small select audience, to play with a USB steering wheel plugged into their computer just because you love drifting, and are in it for the sake of drifting, and are thus willing to learn a hard simulation. Then what you have is really awesome.

    On the other hand if what your doing is attempting to make a game lots of people want to play, maybe post it as a web game and try to get ad revenue, or put it on the iOS app store for revenue. Well I think you need to make it WAAAAY simpler.
     
  16. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    I'm more like aiming at realism, and if my goal is achieved, i will add TCS ABS and some arcade elements that can be switched on/off (some helpers for keyboards etc). But first things first, as realistic as i can get, personally i think the clutch is not working correctly...
     
  17. omarzonex

    omarzonex

    Joined:
    Jan 16, 2012
    Posts:
    156
    wow beautiful Nice drifting

    Nice Car and Design and Programming Physics
     
  18. TiG

    TiG

    Joined:
    Feb 28, 2011
    Posts:
    308
    Very nice. Keep on developing...
     
  19. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    251
    nice man, keep it up...
     
  20. jujunosuke

    jujunosuke

    Joined:
    Apr 30, 2011
    Posts:
    187
    Dude, it is very good, we can really feel the weight of the car here.
    In my opinion its even better than the overrated edy's car physics..

    May i ask how you made the skidmarks ?
     
  21. bart_the_13th

    bart_the_13th

    Joined:
    Jan 16, 2012
    Posts:
    445
    Very nice indeed, I like the car's physics, plus the fact that the grass has different friction factor from the asphalt... In fact, I like to drift the car on grass since drifting on the asphalt is a little bit hard, maybe adding more torque to the engine or lowering the tire's grip. Also the tires should have different(lower) friction when they lose the grip during drifting.
    Oh and one more thing, maybe you should change the handbrake button to shift since I can't do handbrake using spacebar while pressing up and left arrow...
     
  22. DEtH_MoroZ

    DEtH_MoroZ

    Joined:
    Nov 22, 2011
    Posts:
    43
    nice. requesting 13k rpm, mouse steering and different button for clutch! :D
     
  23. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    Hello there. About drifting and the overall physics, well the title is currently abit missleading, since right now im trying to get the most realistic car with stock parameters into my simulation. And yes if i get a realistic car simulation done then I'll add a roaring powerfull engine, drift tyres and suspension with realistic angles such as caster, toe (camber is allready in the simulation).

    Anyway yesterday i updated the webplayer, with a new car and an older track(witch has a better "race" layout)


    and the game link is the same
    http://sideways.dezine.net.ee/
     
  24. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    and a temporary supra version, it has some downgrades since it uses some parts of my old code, but for me it kind of seems more realistic then the e30 version, try them both and tell me witch one seems better more real?
    http://sideways.dezine.net.ee/stocksupra/
     
  25. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    753
    When resetting, you forget to reset the physics as well, with hilarious results.
     
  26. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    I know haha, it's a quick and dirty reset button, actually i havent focused on how to reset the forces acting on the car lol
     
  27. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    Hey!!! wow!! the BmW car demo is addictive!!! its really good! much improvement!_!.

    The sound is PERFECT,, engine sound is amazing.!_!
    ________________________________________

    some cons
    >>
    in teh straights its a bit difficult to control the car. May be its due to keyboard imput. Cant test with a joystick or wheel.
    When you're almost stopped the car move sideways... bizarre.
    Could you add a bumper cam ?? just to see how it feels the handling seen from there.
    ____________________

    The supra engine also sounds very good but the handling is better in the other demo. IMO.
     
  28. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    Update! 11.05.2012
    A massive update from the previous version:

    http://sideways.dezine.net.ee/

    So today i made some gagues in photoshop from scratch and i decided to add few more features with those features my results were mind blowing for myself so i thought Id showcase my current progress of my car simulation project (mainly aimed for drifting but can handle any car).

    Features:
    (+ featured, - not yet featured)
    Current setup is a quite stock mustang with a engine of:
    278.2rwhp@5800 281.6ft-lb@4400 (source Pop Hotrod 1.355)
    Since the car has no TCS and the differential is Vicious Lsd, the car tends to naturally drift because of the powerful engine.
    But to make the car a drift beast, try this setup for a start in the telemetry togle:
    Torque X 2
    Springs F 90 R 70
    Camber F -4
    Steering 58
    Height 0.24

    ..oh yeah 1,2,3 change cameras.

    Also a G25 steering wheel is featured, but there is no force feedback at the moment so the result might not be that satisfying.

    The author of the car is Stecki.
    The ebisu track is property of EA and used as a place holder for this demonstration version.
     
    Last edited: May 11, 2012
  29. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,563
    Feels great! I love it :)
     
  30. B1uEM4oM4o

    B1uEM4oM4o

    Joined:
    May 11, 2012
    Posts:
    1
    Hey! are you releasing your source code for this at any point? It would make a great educational tool, a lot of people would love to learn to make cars like you.
     
  31. Gherid_lacksGPS

    Gherid_lacksGPS

    Joined:
    Dec 3, 2011
    Posts:
    111
    Holy S*t, this is getting ridiculous. Incredible work. Just amazing. You have a real winner here. Really looking forward to its release. The BOV is epic, btw. So clean. Not to familiar with the drifting scene, but that looks to be modeled off of Drift Land?

    Edit; Oh, quick question. When setting up your vehicles, are your "power settings" based on a working system of torque / hp, or an arbitrary number scale? You mentioned specfic power numbers with the stang, which lead me to think that you have a system which actually translates to real world power figures? Or, at least figures that translate into a reasonable threshold of real world drive train measurement?
     
    Last edited: May 11, 2012
  32. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    Hey Gherid_lacksGPS! Thanks for the comments that track is a known drift track google it "Ebisu South" and you will find more info on the track, its amazing popular.

    The power figures are currently selectable, a quick setup with constants from real world. It generates a torque curve out of the constants, but for a more accurate reaction there are also abilitys to read torque curves a.k.a. Dyno sheets. Most of the sheets are 99,9% accurate. So yeah both are suported, a reasonabe figure and a real figure, depends on the configuration setup.

    And as a sneake peek to the far future, i'm planning to make a torque curve out of physical engine data (Cylinders, Cylinder radius, Fuel intake, Air intake). But this feature is just a dream right now because i am not focused on it.

    B1uEM4oM4o, I am releasing a MoDyEn unity package for the comuniti for a prize (Not set right now).
     
  33. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    ... updated link, fixed sound issue (my 6 sample sound system was not working), also added drift setup quick togle.
     
  34. jujunosuke

    jujunosuke

    Joined:
    Apr 30, 2011
    Posts:
    187
    Dude, you made awesome progress since the last version and the last time i played.
    You already achieved a really stable simulation ! congratulation !


    I have 2 questions to ask to you :
    - How do you calculate the load on the tire ? It is heavily related on the car acceleration if i am not wrong, and there is no stable way to calculate rigidbody acceleration in Unity right ?

    - Also, is you tire model different at low and high speed ? Or do you have a unique tire model ?

    Thanks !
    And Good luck :D

    For the next demo, i would suggest that we can select different cars, and also i had problem for resetting the car.
     
  35. Majatek

    Majatek

    Joined:
    Apr 17, 2011
    Posts:
    19
    Biggest pet peeve I have with the project would be the way how the car lurches along at low speed as if it's hitting hundreds of little road humps causing it to bounce constantly.
     
  36. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    Hi. Nice demo, graphically is beautifull, even if its not the goal of the demo.

    About the physycs, may be you should expose some variables because the handling is still a bit odd. IMO:

    The engine friction is too high.

    The wheel forward friction seems to high or so, because the car looses speed extremelly high.

    The sideways friction seems a bit too low as the car is able to continue stright even if the wheels are turned.

    I think these are the biggest issues I found playing with the demo.

    External 3 camera is great to see how the car behaves.
     
  37. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    thanks Pulov, will be checking this out soon and decreasing the engine friction coeficiont, i set it like this because all of the cars I have driven felt like slowing down dramatically when releasing the throttle, but it might be an illusion of my mind. Atleast a Toyota Corolla 3 door Hatchback 1.6 Si(older generation 7th i think) breaks speed really fast, thats the car i sort of owned for the winter.

    Abot the tires, there might be something about the body inertia, try changing the inertia in telemetry screen, it affects how fast the car reacts in one or another direction of movement, its calculated in car terms(axles etc).

    Thanks for the camera coment, I'm actually planing to make a racetrack camera system, but im to busy fiddeling with the physics so that i forget about the cameras.

    Majatek, hmm It's probably one of the things you cant fight without a hack, because the phyics calculations are always called, and at low speeds its constantly ading suspension forces and constantly recalculationg everything ... tho i think its not noticeable when not in the telemetry view. Also keep in mind that different surfaces have different parameters, for example grass bumps alot, because of it not being so solid as road.

    Jujunosuke, the load is calculated the way it should be. About rigidbody accelerations, hmm i think eVerything is possible since the physics engine is not unity, but PhysX and i have previous experiense with physx and every physics engine actually works quite the same. So if you mean by G calculations, for visualising, then i havent doen them myself. But i'm possibly going to do this soon more feedback of the physics engine itself. If you are trying to get the wheel load using the G's then i think you are going in a wrong direction in coding wise. As you know when programming something, especially physical, you will have to start from a mathemathical perspective, and mostly from the places you wouldnt start if you were a car engineer. But i quess if you can understand both, then you are a mastermind hehe. For the tire model, it's always the same no switching is done, tho i have a little magic of my own :)


    Will do a carshowroom for the next demo. The reseting now works better, tho some how i can not reset rigidbody.velocity, the car just boost outside of the view cords...
     
  38. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    Mmm about the engine friction.

    I might have made a mistake here. I've a Citroen C4.. .. the engine friction affecting the car speed is pretty much linked on wich gear you're ... so if you're running at 60km/h and you put 1st gear (not possible in my car) yes there will be a huge friction and probably wheels may block or something...

    but having this friction might be usefull when using pedals or so. With keyboard, when you stop accelerating the friction feels huge.

    Thi is pretty much what I meant, just wanted to clarify.
     
  39. jujunosuke

    jujunosuke

    Joined:
    Apr 30, 2011
    Posts:
    187
    I know exactly how to get the load on each wheels, but, there is no way to get a stable rigid body acceleration using Unity and PhysX:

    http://answers.unity3d.com/questions/48179/rigidbody-acceleration.html
    Correct me if i am wrong.

    Anyway i will also post my car physics simulation soon on the work in progress forum.
    So, we will be able to compare stuffs more precisely.

    Cheers and good luck.
     
  40. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    Hmm my aproach is deffinently different, altho it does use deltaTime, so in one or anotherway there will be numerical noise and actually i think every sim has this noise, only they filter it out with a damping formula or something else to smothen it. Mostly they dont let the audience see theyr raw data (for example raw load or raw slipratios) because its to jerky to show.

    Tho i dont know how iRacing does their calculations, because its the most paid and they say the most acurate sim on the market, so i bet they have some real calculations done.

    Thats cool, cant wait to see this! I am a car enthusiast i can say haha and every car related stuff in a virtual space is really interesting to me.

    edit: just got the G-Meter in and working.
     
    Last edited: May 16, 2012
  41. SimAtanasov

    SimAtanasov

    Joined:
    Jan 15, 2012
    Posts:
    3
    I gotta say, playing your web demo is the most fun I've had on a racing game for PC in a looooong time :) I've been waiting for a drift concentrated game and am really excited about it! I spent some time adjusting the drift setup to make it more easily controllable with a keyboard and it works quite well. The Ebisu circuit has perhaps a bit too much tight corners for that setup of mine, but on the longer smoother ones it runs quite well. I've bookmarked the project's blog too, so I'm following closely ;) The screenshots are awesome too! I'm not very fond of American cars used for drifting, so I can't wait to try out either the supra or the subi or anything else Japanese :) Also I can't really support you by donating (cus I'm a student and you guessed it - I'm flat broke :D ), but I would definitely be happy to help with something else, if you accept voluntary help. I mostly do 2D stuff, but I have knowledge of 3D as well. Let me know if you want to see stuff I've done :) Cheers and keep up the awesome work! Can't wait for the next release!
     
  42. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    584
    Thanks, this is cool! Yes you can send me a pm of your works for example. The next release will be much better, ive done some mayor fixes again, and added some neat features, one of them is G-Meter, but ive got a bunch loads of other new stuff also, hopefully a new version will be up in a week.
     
unityunity