how to make this top down 2d car drift right.
I have been working on a top down 2d car model. The goal was to have a car model which can drift the real way, (swinging the back hard and counter steering.) not just make the car slide when steering.
So i thought the best way would be start with a wheel based model. where I make wheels and just attach them to a body. and handle physics on the wheel.
This is my bitbucket link https://bitbucket.org/cyberquad/game_1/src/master/
Basically i am handling the x velocity of the tyres. By adding drag and controlling the acceleration on x axis of the wheel. I have removed all drag and angular drag that unity provides because that is applied in all directions and tyres don't feel same drag on x axis compared to y axis and thought this will be crucial to get the drift working.
These are the things i have tried.
I added a percentage drag on x axis, i.e. multiplying x with drag every frame. but that was not working well, values from 0.1 to 0.9 all of them seem to put a lot of drag and the wheel barely slipped. only values like 0.99 worked. but then it was too much. I oscillated between 0.9 and 1 and the wheel slipped but couldn't get the drift with counter steering.
I tried varying drag, thinking that once the wheel slips it doesn't feel the same drag. So i made a range of drag and applied if based on the acceleration on x velocity (difference between previous and current velocity). But that has some weird behaviour. it took to get the wheel to slip as drag would be high on the beginning, and as a result you have turn the car hard and once the wheel slipped, the wheel would quickly slip a bit too much, which is needed anyway to drift. But when the counter steer is done, the acceleration on x falls and the drag quickly lowers and the slip is gone. cant drift.
Finally i though just drag won't work, and started adding x velocity based on acceleration myself and applied a different drag logic when no acceleration was felt. Now i can drift, but it feels very bad, in terms of control of the car. The control of initiating a drift and holding it and reverse drifting is very hard, and feels unnatural.
I have worked almost a whole month on this and my brain has melted. I am not expecting code as an answer, just some direction on how to get this right will be appreciated cos i know this is the wrong direction as it not yielding any results. If you have read this far am already appreciating the effort.
Thanks.
Your answer
Follow this Question
Related Questions
2D Knockback problem 2 Answers
How to make an skidmarks system on a 2D top-down car sprite? 0 Answers
Generate 2d star background 0 Answers
Getting the correct angle for OverLapBoxAll 1 Answer
Create a smooth camera without jittering/flickering in 2D 3 Answers