Hello all ! some question ?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Neolitik
Citizen
Posts: 55
Joined: Sun Jun 28, 2009 3:13 pm

Hello all ! some question ?

Post by Neolitik »

Hello , and happy new year for all !

I have a question :

there is possibility of creating a car movements with just love.physics Body ( one body ?)?

thank
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Hello all ! some question ?

Post by Robin »

Well, you could try, but that's not the sort of thing Box2D excels at.

Rolling your own collision detection will probably be better for car movement.
Help us help you: attach a .love.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Hello all ! some question ?

Post by kikito »

First assumption: with LÖVE you can do only 2D stuff. No 3D.

You can create a car "in which you always see the side, so you only simulate two wheels". I mean this:
car-side.jpg
car-side.jpg (12.86 KiB) Viewed 2497 times
So you can have your "car" go up and down on ramps, jump, have suspension, etc. But you can't make it turn. Granted, it would be more like a bicycle than a car.

You can also do a game in which you "see the car from behind", like in Out Run. But on that case, you probably don't need physics.
car-back.jpg
car-back.jpg (5.53 KiB) Viewed 2497 times
You will not be able to simulate a car "in which you see the roof, so there are 4 weels". So this, you can't do:
car-top.jpg
car-top.jpg (13.09 KiB) Viewed 2497 times
When I write def I mean function.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Hello all ! some question ?

Post by Robin »

kikito wrote:You will not be able to simulate a car "in which you see the roof, so there are 4 weels". So this, you can't do:
Why not?
Help us help you: attach a .love.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Hello all ! some question ?

Post by kikito »

Why not?
Damn. You already know my math isn't strong! I'll try to explain myself in layman's terms (which is the way I think).

The Box2d world is "2D". You to simulate "circles", "polygons", etc... 2D stuff.

You can simulate the car on the ground like a "square" moving around in 2D. It'd "drift", like a block of soap. I've said you can do the "back" because that perspective would kind of "mask" the drifting. But with a "top" perspective it would be too evident.

In order to accurately simulate a car's turning, you need to model "cylinders rolling over a plane" ... which is kind of 3D-ish, and thus out of Box2d's reach, I think. You have to calculate the turning with lua, or have a "soap block".

But please, prove me wrong. I'd love to be wrong on this one.
When I write def I mean function.
Neolitik
Citizen
Posts: 55
Joined: Sun Jun 28, 2009 3:13 pm

Re: Hello all ! some question ?

Post by Neolitik »

yop ,

i find for car with box 2 on the net.
you can make topdown view car : look here

http://www.emanueleferonato.com/category/box2d/page/4/

it' s box 2d prog !

i dont understand all the code lol ^^
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Hello all ! some question ?

Post by kikito »

I was wrong! great!

So, the answer to your question is yes... it is only a matter of translating now!
When I write def I mean function.
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Hello all ! some question ?

Post by Taehl »

All you'd need to do is apply a force to the top-down car which pushed it left or right if it was moving right or left (respectively), taking into account the car's rotation. Then the car would only be free to go forward or back.The math for this would be a little hairy, but it'd be perfectly doable.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Neolitik
Citizen
Posts: 55
Joined: Sun Jun 28, 2009 3:13 pm

Re: Hello all ! some question ?

Post by Neolitik »

i have make a little simulation top view of car with one physics body , i ' m think there is another way to make it .
i 'm not good in math :nyu:

try , if that can help some ^^

arrow key for control

by all

" soory for bad english i'm french "
Attachments
phycar.love
(4.14 KiB) Downloaded 105 times
Last edited by Neolitik on Fri Jan 29, 2010 4:55 pm, edited 1 time in total.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Hello all ! some question ?

Post by TechnoCat »

Neolitik wrote:i have make a little simulation top view of car with one physics body , i ' m think there is another way to make it .
i 'm not good in math :nyu:

try , if that can help some ^^

arrow key for control

by all

" soory for bad english i'm french "
It is like the rear wheels are turning. lol
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 58 guests