Truck car physics

Discuss issues specific to using Box2D on the iPhone
KAMIKAZE
Posts: 17
Joined: Thu Jun 28, 2012 1:57 am

Truck car physics

Postby KAMIKAZE » Thu Jun 28, 2012 6:47 am

Hi,

I was looking for a good tutorial about box2d and creating some vehicles, but couldn't find a good example for iPhone. Only one link for Flash:
http://www.emanueleferonato.com/2009/04 ... ox2d-cars/

Can some one give an example of such vehicle like Emanuele Feronato gives, but for iPhone? Also I'm interested in creating vehicles like this :
Image

So, with independent suspension for each wheel.

irresistible force
Posts: 1991
Joined: Tue Jun 24, 2008 8:25 pm
Location: Tokyo
Contact:

Re: Truck car physics

Postby irresistible force » Thu Jun 28, 2012 7:59 am

The wheel joint does a good job of this. Check out the 'car' test in the testbed for a simple usage example in C++.

KAMIKAZE
Posts: 17
Joined: Thu Jun 28, 2012 1:57 am

Re: Truck car physics

Postby KAMIKAZE » Thu Jun 28, 2012 8:53 am

Can you please point directly to this? I'm a noob with box2d currently...

irresistible force
Posts: 1991
Joined: Tue Jun 24, 2008 8:25 pm
Location: Tokyo
Contact:

Re: Truck car physics

Postby irresistible force » Thu Jun 28, 2012 6:35 pm

Build and run the testbed, then select 'Car' from the list of tests. Specifically, the test is this one:
http://code.google.com/p/box2d/source/b ... ests/Car.h

KAMIKAZE
Posts: 17
Joined: Thu Jun 28, 2012 1:57 am

Re: Truck car physics

Postby KAMIKAZE » Fri Jun 29, 2012 1:18 pm

Oh, thank you!
Box2d manual must be with detailed description of this. Currently it's so poor.

KAMIKAZE
Posts: 17
Joined: Thu Jun 28, 2012 1:57 am

Re: Truck car physics

Postby KAMIKAZE » Wed Jul 25, 2012 7:40 am

Ok. I've started some project to build a car.
However I have a very strange issue, when the car body is small. Car start jumping, rotating... well it's do crazy things) How this can be fixed?
I need such small size car body for my game. :arrow:

Complete project http://rghost.ru/39408443
Attachments
Снимок экрана 2012-07-25 в 17.34.37.png
Снимок экрана 2012-07-25 в 17.34.37.png (71 KiB) Viewed 6109 times
Снимок экрана 2012-07-25 в 17.34.53.png
Снимок экрана 2012-07-25 в 17.34.53.png (70.54 KiB) Viewed 6109 times

irresistible force
Posts: 1991
Joined: Tue Jun 24, 2008 8:25 pm
Location: Tokyo
Contact:

Re: Truck car physics

Postby irresistible force » Thu Jul 26, 2012 4:38 am

It looks like the joint anchor position is not in the center of the wheels.
I think you'll also need to make the car body much heavier compared to the wheels if you want to keep it stable.

KAMIKAZE
Posts: 17
Joined: Thu Jun 28, 2012 1:57 am

Re: Truck car physics

Postby KAMIKAZE » Tue Mar 25, 2014 10:43 am

Old theme, but I want to continue ;)

I've modified car body and now it's much heavier than wheels. Car looks normal now.

I have another question about motor and car moving. I've created a simple car with 2 wheels and now I want to move it using touch. My car is needs to be all wheels drive.
When I want to run car forward I set for all wheels:
-motor enabled,
-motor speed: -40
-motor torque: 30

As result car immediately starts rotating counterclockwise or gets wheelie :) But I want my car just properly drive through level...
I've tried change motor values to lower, as result: car can move better, without rotating, but it can't climb the walls.. attached level example.

Can some one give a good example of car with configured physics? That can move without glitchy rotating, can climb walls(this probably will be done if prevent car rotating...)
I appreciate any help...
Attachments
car.jpg
car.jpg (31.07 KiB) Viewed 4293 times

S986S
Posts: 34
Joined: Sat Mar 01, 2014 7:39 am

Re: Truck car physics

Postby S986S » Tue Mar 25, 2014 7:25 pm

You experiencing the ups and downs of game design.

Don't worry, relax and experiment.
Something important to note is how are monster tracks actually designed
http://www.caranddriver.com/features/the-physics-of-monster-trucks-feature

Its important to note
weight of a wheel 900lbs-3600 in all
Total weight is 12,000
So the chassy is about 8000

All of which is distributed over the entire area the wheels are covering

If you put the Chassy above the back wheel, would the car flip?
If you put the chassy above the front wheel, would the car flip?
-could you go backwards without flipping?

If you made the chassy larger, would it flip?
If lowered its center of gravity, would it flip?

If you made it 2 wheel drive?
If you made the front wheels heavier?

Image
There's a reason why there are strange designs still work ;)

KAMIKAZE
Posts: 17
Joined: Thu Jun 28, 2012 1:57 am

Re: Truck car physics

Postby KAMIKAZE » Wed Mar 26, 2014 11:05 am

Well, my game physics may be no as real, with real values. Finally, i just have a density parameter for body.

Too many questions ;) but I can do only some of them, because of my game.. I can't put car body to not proper position...

If you made the chassy larger, would it flip?

if I do it my car becomes heavy in moving, and this is bad. But it still trying to flip, just front part of car goes a little bit up..

If lowered its center of gravity, would it flip?

I can't do this.. because of game mechanics

If you made it 2 wheel drive?

Already and as I said before - it must be only full wheel drive. Count of wheels also can be more than 2.

If you made the front wheels heavier?

Yes, flip will be less, but what If I want to move backward? It will flip, and very fast :)

Very strange, I try to google a good example of truck car physics using box2d and can't find any useful example...


Return to “iPhone”



Who is online

Users browsing this forum: No registered users and 1 guest