[SOLVED]: Two questions about vehicle

yiannis
Posts: 3
Joined: Fri Apr 20, 2007 12:52 pm

[SOLVED]: Two questions about vehicle

Post by yiannis »

Hi all,

I 'm testing bullet for a project and I like what I see so far :).
I got a couple of questions regarding vehicles though.

1) Any estimate on when braking will be implemented?

2) I have built a test app for testing vehicles. I started out by duplicating code from the vehicle demo. Now, everything goes well except one thing: my vehicle rolls over pretty easily if I slightly turn the wheels (not at max speed).
In other physics engines, I usually adjusted this by lowering the center of mass to be even below the vehicle (in some cases).
Is there a solution to this problem?

I should note that I 'm not after an ultra-realistic vehicle here. A simple, more "arcade" vehicle will suffice for my needs.

Regards.
Last edited by yiannis on Thu Apr 26, 2007 6:29 pm, edited 1 time in total.
bone
Posts: 231
Joined: Tue Feb 20, 2007 4:56 pm

Re: Two questions about vehicle

Post by bone »

yiannis wrote:2) I have built a test app for testing vehicles. I started out by duplicating code from the vehicle demo. Now, everything goes well except one thing: my vehicle rolls over pretty easily if I slightly turn the wheels (not at max speed).
In other physics engines, I usually adjusted this by lowering the center of mass to be even below the vehicle (in some cases).
Is there a solution to this problem?
That's usually the first attempted solution. Or you could put your physical wheels further out than the graphical wheels, an effective increase in track width. Or you could reduce grip (but I'm guessing you have the grip level where it is for a reason).

In real cars, gyroscopic precession of the wheels also causes a slight increase in the roll of the vehicle, so reducing the rotational inertia of the wheels can help. But I think the gyro effect is off by default in Bullet (I know it was in ODE), so that probably won't do you any good.

The fact is, good grip, insufficient track width, and high heavy centers of mass is why SUVs are always rolling when they get in an accident, even though everybody thinks they bought one because they're "safe".
Sphere
Posts: 4
Joined: Sun Apr 22, 2007 4:18 pm

Have a look at my demo and see if it helps...

Post by Sphere »

User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Basic braking is now implemented, and will be available in Bullet 2.50.

You can get the subversion version, or download this early build here:
http://www.bulletphysics.com/bullet-2.50a.zip

With respect to turning over, you can lower the center of gravity by using a btCompoundShape and adding the chassis as childshape with a transform. Some sample code should be added to the vehicle demo to make this easier.

Another way of reducing this unwanted effect is setting the 'rollInfluence' for each wheel. Tune the rollInfluenceValue between 0 and 1, try 0.1 for example:

Code: Select all

float rollInfluence=0.1f;
for (int wheelIndex=0;wheelIndex<vehicle->getNumWheels();wheelIndex++)
{
      btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex);
      info.m_rollInfluence = rollInfluence;
}

Hope this helps,
Erwin
yiannis
Posts: 3
Joined: Fri Apr 20, 2007 12:52 pm

Post by yiannis »

Erwin Coumans wrote:Basic braking is now implemented, and will be available in Bullet 2.50.
Thank you for this :)
Erwin Coumans wrote:With respect to turning over, you can lower the center of gravity by using a btCompoundShape and adding the chassis as childshape with a transform. Some sample code should be added to the vehicle demo to make this easier.
Is this what you 're already doing in the vehicle demo?

Code: Select all

	btCollisionShape* chassisShape = new btBoxShape(btVector3(1.f,0.5f,2.f));

	btCompoundShape* compound = new btCompoundShape();

	btTransform localTrans;

	localTrans.setIdentity();

	//localTrans effectively shifts the center of mass with respect to the chassis

	localTrans.setOrigin(btVector3(0,1,0));

I have already tried doing something similar but have failed to make it work :(. No matter what I do, the center of gravity doesn't seem to be affected.
Should I be changing any settings of the wheels/suspension too?

Thanks for bearing with me.
yiannis
Posts: 3
Joined: Fri Apr 20, 2007 12:52 pm

Post by yiannis »

As it turned out, my problem was wrong rendering of the vehicle chassis, and all my tuning efforts were wrong (I was seeing it correctly but the actual physics side was different).

I feel stupid now :oops:.

Thanks everyone for the help :).