Vehicle demo

Show what you made with Bullet Physics SDK: Games, Demos, Integrations with a graphics engine, modeler or any other application
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Vehicle demo

Post by mi076 »

Hello,
... new Vehicle demo, with vehicle configuration dialog. May be
useful.

http://code.google.com/p/game-ws/
Attachments
s0.jpg
s0.jpg (38.66 KiB) Viewed 52502 times
Last edited by mi076 on Sat Jul 16, 2011 11:18 pm, edited 1 time in total.
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: Vehicle demo

Post by mi076 »

<...>
Last edited by mi076 on Sat Jul 16, 2011 11:25 pm, edited 1 time in total.
Mic
Posts: 1
Joined: Thu May 28, 2009 8:16 pm

Re: Vehicle demo

Post by Mic »

Outstanding demo. I have a few questions, in terms of building the assets and assembling the scene, what modeling program did you use? Also, how are you rendering the scene. Are you using blender, ogre, or something else?

Thank you :)
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: Vehicle demo

Post by mi076 »

<...>
Last edited by mi076 on Sat Jul 16, 2011 11:26 pm, edited 1 time in total.
Verbo
Posts: 39
Joined: Fri May 08, 2009 9:27 pm

Re: Vehicle demo

Post by Verbo »

Very cool!

I see you added wheel width parameters but they don't have graphic and physics feedback yet, are you planning on adding it?

I am also porting Bullet in an engine and I eventually want to be able to take the wheel mass and width into account, and also the ground friction. I also want to have the motored wheel spinning even if there is no contact with the ground. Ouch...lot of work ahead...

See ya!

Verbo
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: Vehicle demo

Post by mi076 »

<...>
Last edited by mi076 on Sat Jul 16, 2011 11:18 pm, edited 1 time in total.
Verbo
Posts: 39
Joined: Fri May 08, 2009 9:27 pm

Re: Vehicle demo

Post by Verbo »

Hi,

I am currently testing my new Bullet vehicle and I have some problems. I wonder if you ran in the same issues or questionning. I also tried to emulate your settings as much as I could (even if my car model is not the same...it has more a dodge charger style ) so that my question make more sense.

My settings are:

mass: 800kg
max steering: 40 degree
max engine force per wheel = 2000
max braking force per wheel = 500 -> I am not using it yet however, I am just using negative force for the moment(more like an electric car...)
static friction: 2
susp stiff: 20
susp rest: .1
susp damp: 2.3
susp max travel: 10 cm
roll influence: 0.2

1) The engine force you are using is a value per wheel, right? Because in my implementation, I allow the user to define how to distribute the force to each wheels (I use a torque ratio that defines what part of the total engine force is going to each wheel), so I guess I have to put a lot more engine force to take the torque distribution distribution into account.

2) If I use a max travel length of 10 cm, I see my rear wheels sink half way to the ground.

3) I see in the Bullet Vehicle that if we are braking, we stop applying engine force or vice-versa, but I aren`t we able to do both together with a real car? It seems to me that when I drive my car and press the brake pedal, the engine doesn`t stop applying force right away, because the engine is still revolving, and in the more extreme case, I remember braking both pedals at the same time (it was a crazy night when my gas pedal cable was frozen, so I had to brake every 20 sec to avoid reaching sublight speed...). I don`t know, I might be wrong, but my first guess would have been to cumulate the engine force and the braking force, This way we could brake while pressing gas to acheive some driving tricks, etc etc...
Again, I am just raising the question, no offense hey :)

4) How do you take the ground friction into account? From what I tested, even if I set the floor friction to 0.00001, the car doesn't behave differently at all. Shouldn't we multiply the ground friction by the friction slip and do a square root to get the real friction?

Thx. :)

Verbo
vikthered
Posts: 6
Joined: Fri Aug 07, 2009 7:00 pm

Re: Vehicle demo

Post by vikthered »

Hi,

Has anyone implemented the vehicle demo on the iphone? Is it slow on the device?
smjones
Posts: 5
Joined: Mon Oct 15, 2007 2:37 pm

Re: Vehicle demo

Post by smjones »

Awesome! I haven't gone into the details yet but I am interested in the vehicle physics design and there configuration values. I guess that's like everybody else! :)
At my company I have been asked to investigate vehicle physics. Our primary application will be a high fidelity flight simulation with vehicles traveling on highways. My company makes UAVs and my job is involved in creating flight simulator software for our UAV trainers. My point is the application isn't going to be a high speed racing game. (although that would be sort of fun to give the UAV payload operator something fun to look at!) :D Although I don't think the Army would think that would be very funny. They don't have a sense of humor as far as I'm aware of. :P No disrespect intended to any military folks! I respect your job completely.

I've read a little bit that Bullet physics has a better or more complete vehicle class than other physics SDKs such as PhysX. Is this true? I'm traveling up a steep learning curve so I need all the help I can get.

Thanks so much for putting in all the time and effort in this demo.


EDIT: Oh one more thing. I forgot to say that TAB didn't work for me to change directions. I got the car stuck a few times and couldn't back up. No problem though! I just restarted the app. My main thing was to see a good sample of very tuned vehicle dynamics using Bullet.

Steve
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: Vehicle demo

Post by mi076 »

Thank you very much for looking into it..
I forgot to say that TAB didn't work for me to change directions.
Oh, mea culpa, it is BACKSPACE...

May be i shall update the demo.. There are some minor simulation issues i would like to check, but first i have to look at new Bullet version. Thank you.
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: Vehicle demo

Post by mi076 »

<...>
Last edited by mi076 on Sat Jul 16, 2011 11:26 pm, edited 1 time in total.
dumbo2007
Posts: 66
Joined: Sun Jan 30, 2011 8:46 pm

Re: Vehicle demo

Post by dumbo2007 »

Thanks for the great demo. I am trying to integrate the Vehicle Model into a game and I found your code easy to understnad and learn from. I was wondering how complex is it to add a engine model with gears. Is it possible to integrate something like the Vehicle Dynamics Library or similar library into your code ?
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: Vehicle demo

Post by mi076 »

@dumbo2007
Thank you very much! You are right, the vehicle needs engine model. Currently "throttle" is temporary and very very simple... I have started once implementing engine, but haven't finished it, i hope i shall do it little later or take it if i shall find good code (throttle, gear, rpm/power, etc). Sorry for late response.
dumbo2007
Posts: 66
Joined: Sun Jan 30, 2011 8:46 pm

Re: Vehicle demo

Post by dumbo2007 »

hey,

yeah I am going to trying to build some gearing code. I was wondering if you would know whether Bullet simulates friction and torque to the extent required for this. For example at 1st gear the torque output is maximum but the angular velocity is less. But this will not make any difference when the vehicle is climbing up a slope unless Bullet simulates torque and friction accurately. Similarly at 5th gear the torque is very less but angular speed output is high. So the vehicle should have lot of trouble even holding position on the slope. Probably I can fix some sort of power output value of the engine and since the power remains the same after a gear transition, I can use it to calculate the torque and finally the rpm.

Which brings me to another point...is it possible to set the torque of the wheels individually at every step in the simulation with a ray cast vehicle ?
proof
Posts: 18
Joined: Tue Mar 01, 2011 11:00 pm

Re: Vehicle demo

Post by proof »

For the gearing system, each gear should have its ratio:

Code: Select all

gear. no.     ratio
-1              -1
0                0
1                2.3
2                1.8
3                1.3
4                0.9
5                0.5
The current torque you should apply is the currentGearRatio * baseTorque. The hardest thing to implement gears would be to calculate the RPM. Once you do, you can define values: maxRpm = 8000, minRpm = 1000, maxRpmToGearUp = 6000, minRpmToGearDown = 4000. The following rules apply:

Code: Select all

limit: minRpm <= currentRpm <= maxRpm
if (currentRpm >= maxRpmToGearUp && gear != maxGear)
{
   currentRpm = minRpmToGearDown + 100;
   gear++;
}
if (currentRpm <= minRpmToGearDown && gear != minGear)
{
   currentRpm = maxRpmToGearUp - 100;
   gear--;
}
Then you could just apply the baseTorque * gearRatios[gear] and that should work for a base. (at least, that's how I plan on implementing it)

On the other hand, has anyone played around with the vehicle configuration? For the past couple of days I've been trying to find an optimal configuration and I just can't seem to get it right. What I'm looking for can be seen here: http://www.youtube.com/watch?v=BJidtxqDtfo#t=1m28s

One thing I have noticed is that if you steer left, the car tilts to left and it should tilt to the right which is an odd behavior :roll:
Post Reply