floaty drift vehicle physics

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
CR4SH3D
Citizen
Posts: 67
Joined: Mon Mar 02, 2009 6:00 pm
Location: England
Contact:

floaty drift vehicle physics

Post by CR4SH3D » Tue Aug 18, 2009 7:35 am

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

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: floaty drift vehicle physics

Post by TechnoCat » Tue Aug 18, 2009 5:03 pm

I would imagine you just turn down the friction and keep gravity at (0,0)

User avatar
CR4SH3D
Citizen
Posts: 67
Joined: Mon Mar 02, 2009 6:00 pm
Location: England
Contact:

Re: floaty drift vehicle physics

Post by CR4SH3D » Tue Aug 18, 2009 9:21 pm

but working out angles and the heading using sin etc? i dont know how that works, any ideas?

User avatar
Pliskin09
Citizen
Posts: 89
Joined: Fri Jul 24, 2009 8:30 am

Re: floaty drift vehicle physics

Post by Pliskin09 » Tue Aug 18, 2009 11:08 pm

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

User avatar
CR4SH3D
Citizen
Posts: 67
Joined: Mon Mar 02, 2009 6:00 pm
Location: England
Contact:

Re: floaty drift vehicle physics

Post by CR4SH3D » Wed Aug 19, 2009 2:26 am

ive had a go and think it should work but the values arnt numbers :S does anyone have any ideas?
Attachments
wipeout-00.love
(211.95 KiB) Downloaded 67 times

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: floaty drift vehicle physics

Post by TechnoCat » Wed Aug 19, 2009 2:47 am

Code: Select all

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

User avatar
CR4SH3D
Citizen
Posts: 67
Joined: Mon Mar 02, 2009 6:00 pm
Location: England
Contact:

Re: floaty drift vehicle physics

Post by CR4SH3D » Wed Aug 19, 2009 2:27 pm

so how do you go about using it then? the angles are messed up
Attachments
wipeout-02.love
(212.08 KiB) Downloaded 72 times
wipeout-01.love
(212.01 KiB) Downloaded 63 times

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: floaty drift vehicle physics

Post by TechnoCat » Wed Aug 19, 2009 7:26 pm

I pretty much completely rewrote it, but have a look at what I did here.
Attachments
VelocityInDirectionOfAngle.love
(2.56 KiB) Downloaded 80 times

User avatar
CR4SH3D
Citizen
Posts: 67
Joined: Mon Mar 02, 2009 6:00 pm
Location: England
Contact:

Re: floaty drift vehicle physics

Post by CR4SH3D » Wed Aug 19, 2009 8:17 pm

thanks, it seems to have lost the drifting using the friction value though, how do you implement that?

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: floaty drift vehicle physics

Post by TechnoCat » Wed Aug 19, 2009 10:19 pm

Instead of using setVelocity, might try using applyImpulse or something similar. Or a hybrid of the two.

Post Reply

Who is online

Users browsing this forum: No registered users and 99 guests