Car drifting/skidding

Hello hello 🙂

I'm developing a racing game based on this sample: http://miian.com/en/blog/mianwo/2009/08 ... g-game-bas and my designer colleague would love to see drifting/skidding happening in the game. By that I mean that when driving forward - say North - fast and you turn West all of a sudden, the car's body should turn but still slide in direction of North 😉

I already wrote the part where i detect if drifting should happen (compare the angle of the wheels + car's body to a driftTreshold). I've tried saving the body's LinerarVelocity and decreasing it 10 times a second and adding it in the car's velocity, but that's absolutely not it, it looks bad 🙂

Does anyone have any tips or ideas how to proceed in this case? It would help me a lot 🙂

Thanks,
Z.
From the little I ko about box2d I think to achieve this effect you should use addForce and impulse to preserve the force of moving north(which will decrease over time using damping and such) when the car starts moving west.
I hope this helps.
Yeah that's what i thought of too, except that i have to determine the right vector (it doesnt always go North)
The problem with this is also that as soon as you start drifting, the addImpulse pushes the car North, so you'll actually speed up and just take the curve faster 🙂

Thanks for your answer but I'm still a bit lost 🙂
Z.
Check out the car physics in QuickB2 (http://quickb2.dougkoellmer.com/bin/qb2DemoReel.swf). They might suit your purposes. Source is at http://code.google.com/p/quickb2/.
dougk16 wrote:
Check out the car physics in QuickB2 (http://quickb2.dougkoellmer.com/bin/qb2DemoReel.swf). They might suit your purposes. Source is at http://code.google.com/p/quickb2/.

Definitely check out QuickB2. I was very impressed by it and by what I saw, what they had would definitely fit your needs.

Original thread: https://box2d.org/forum/viewtopic.php?t=6065