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 »

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 »

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 »

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 »

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 »

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 91 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 »

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 »

so how do you go about using it then? the angles are messed up
Attachments
wipeout-02.love
(212.08 KiB) Downloaded 93 times
wipeout-01.love
(212.01 KiB) Downloaded 89 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 »

I pretty much completely rewrote it, but have a look at what I did here.
Attachments
VelocityInDirectionOfAngle.love
(2.56 KiB) Downloaded 108 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 »

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 »

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: Semrush [Bot] and 81 guests