Page 1 of 1

floaty drift vehicle physics

Posted: Tue Aug 18, 2009 7:35 am
by CR4SH3D
hey guys

im working on a new demo at the moment but im stuck on how to use the physics to allow a vehicle to drive properly as well as drift around turns, think of something like wipeout for an idea of what i mean

are there any really useful links, tutorials or librariess to achieve this? ive had a look for hours and havent turned up anything i can follow yet

a basic .love would be awesome ;)

take it easy

-greg

Re: floaty drift vehicle physics

Posted: Tue Aug 18, 2009 5:03 pm
by TechnoCat
I would imagine you just turn down the friction and keep gravity at (0,0)

Re: floaty drift vehicle physics

Posted: Tue Aug 18, 2009 9:21 pm
by CR4SH3D
but working out angles and the heading using sin etc? i dont know how that works, any ideas?

Re: floaty drift vehicle physics

Posted: Tue Aug 18, 2009 11:08 pm
by Pliskin09
this is writen for a game in java but the math's is just the same i guess.

http://cloningtheclassics.com/classic-a ... cade-game/

it explains it well

Re: floaty drift vehicle physics

Posted: Wed Aug 19, 2009 2:26 am
by CR4SH3D
ive had a go and think it should work but the values arnt numbers :S does anyone have any ideas?

Re: floaty drift vehicle physics

Posted: Wed Aug 19, 2009 2:47 am
by TechnoCat

Code: Select all

craft:setX((craft:getX()) + (xvelocity))
velocity~=position

Re: floaty drift vehicle physics

Posted: Wed Aug 19, 2009 2:27 pm
by CR4SH3D
so how do you go about using it then? the angles are messed up

Re: floaty drift vehicle physics

Posted: Wed Aug 19, 2009 7:26 pm
by TechnoCat
I pretty much completely rewrote it, but have a look at what I did here.

Re: floaty drift vehicle physics

Posted: Wed Aug 19, 2009 8:17 pm
by CR4SH3D
thanks, it seems to have lost the drifting using the friction value though, how do you implement that?

Re: floaty drift vehicle physics

Posted: Wed Aug 19, 2009 10:19 pm
by TechnoCat
Instead of using setVelocity, might try using applyImpulse or something similar. Or a hybrid of the two.