Page 1 of 2
Hello all ! some question ?
Posted: Wed Jan 27, 2010 11:54 am
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
Re: Hello all ! some question ?
Posted: Wed Jan 27, 2010 1:15 pm
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.
Re: Hello all ! some question ?
Posted: Wed Jan 27, 2010 2:47 pm
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 (12.86 KiB) Viewed 2786 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 (5.53 KiB) Viewed 2786 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 (13.09 KiB) Viewed 2786 times
Re: Hello all ! some question ?
Posted: Wed Jan 27, 2010 3:36 pm
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?
Re: Hello all ! some question ?
Posted: Wed Jan 27, 2010 4:51 pm
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.
Re: Hello all ! some question ?
Posted: Wed Jan 27, 2010 5:31 pm
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
Re: Hello all ! some question ?
Posted: Wed Jan 27, 2010 7:34 pm
by kikito
I was wrong! great!
So, the answer to your question is yes... it is only a matter of translating now!
Re: Hello all ! some question ?
Posted: Thu Jan 28, 2010 5:34 am
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.
Re: Hello all ! some question ?
Posted: Fri Jan 29, 2010 1:05 pm
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
try , if that can help some
arrow key for control
by all
" soory for bad english i'm french "
Re: Hello all ! some question ?
Posted: Fri Jan 29, 2010 2:29 pm
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
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