Vehicle Won't Steer?

mmorrison
Posts: 4
Joined: Thu Nov 09, 2006 12:16 am

Vehicle Won't Steer?

Post by mmorrison »

I am trying to set up a simple world with a single vehicle, mostly copied from the VehicleDemo example program in release 2.20b. I am pretty sure I have cut-and-pasted the code correctly, with the main differences being a different polygonal database and the fact that Z is up in my world rather than Y up.

I think i have corrected for the coordinate system and gravity correctly because with my MotionState starting point slightly above the terrain my "vehicle" falls a little and appears to come to rest on the wheels with some suspension compression.

When I call applyEngineForce() on the rear wheels, the vehicle begins to move forward. The problem is, when I call setSteeringValue (with values ranging from -0.3 to 0.3) the vehicle won't steer - it just keeps moving forward as if the tires are not turned. The indices to applyEngineForce and setSteeringValue should be correct.

Any ideas as to what I am doing wrong?

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

Re: Vehicle Won't Steer?

Post by Erwin Coumans »

mmorrison wrote:I am trying to set up a simple world with a single vehicle, mostly copied from the VehicleDemo example program in release 2.20b. I am pretty sure I have cut-and-pasted the code correctly, with the main differences being a different polygonal database and the fact that Z is up in my world rather than Y up.

I think i have corrected for the coordinate system and gravity correctly because with my MotionState starting point slightly above the terrain my "vehicle" falls a little and appears to come to rest on the wheels with some suspension compression.

When I call applyEngineForce() on the rear wheels, the vehicle begins to move forward. The problem is, when I call setSteeringValue (with values ranging from -0.3 to 0.3) the vehicle won't steer - it just keeps moving forward as if the tires are not turned. The indices to applyEngineForce and setSteeringValue should be correct.

Any ideas as to what I am doing wrong?

Thanks.
Did you already hookup the basic debugDrawer to your renderer?

The vehicle demo is hard to debug right now. I just added some debugging rendering for the wheels, to make sure they are in the right place (or are you rendering the wheels already?).
Are you using an unmodified btRaycastVehicle? Did you set the indices of the vehicle like following?

Code: Select all

	indexRightAxis = 0;
	indexUpAxis = 2;
	indexForwardAxis = 1;
Please download Bullet 2.24 (for this updated debug rendering of the wheels) and let me know if there are still issues. Bullet 2.25 will have this updated VehicleDemo that let's you choose Z as up axis, so you can verify the setup. No changes in the Bullet sourcecode is necessary. Get it here:
http://www.continuousphysics.com/ftp/pu ... leDemo.cpp


Thanks,
Erwin
mmorrison
Posts: 4
Joined: Thu Nov 09, 2006 12:16 am

Post by mmorrison »

The problem, by the way, was that I was not calling m_vehicle->updateWheelTransform(i) for every wheel every frame like I should have been. Everything works as expected now.
mmorrison
Posts: 4
Joined: Thu Nov 09, 2006 12:16 am

Post by mmorrison »

Now my vehicle won't stop. :)

There seems to be several issues with braking as of version 2.23. btRaycastVehicle::setBrake doesn't set m_brake to the brake value supplied as an argument, and btRaycastVehicle::updateFriction does not take the brake value into account anyway.

Is this just not implemented yet?

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

Post by Erwin Coumans »

mmorrison wrote:Now my vehicle won't stop. :)

There seems to be several issues with braking as of version 2.23. btRaycastVehicle::setBrake doesn't set m_brake to the brake value supplied as an argument, and btRaycastVehicle::updateFriction does not take the brake value into account anyway.

Is this just not implemented yet?

Thanks.
Brakes and gears are not implemented yet.
Please let me know how urgent you need them, so I can plan them in. Shouldn't be too much work for brakes :)

Thanks,
Erwin
mmorrison
Posts: 4
Joined: Thu Nov 09, 2006 12:16 am

Post by mmorrison »

Brakes would be nice. Gears are not necessary for me for now. Not terribly high priority.