vehicle strange behaviour (with video)

Post Reply
rili
Posts: 3
Joined: Sun Oct 12, 2014 8:09 pm

vehicle strange behaviour (with video)

Post by rili »

hi guys,

i have a problem with my very first bullet vehicle implementation, which actually is just a copy paste of the vehicle sample of the Bullet Demos. (but i think i missed smth there)

After the vehicle is moving with a velocity of 150 km/h and above, its wheels start to vibrate and then the chases starts to bump up and down on the suspension of its wheels.

i have posted a youtube video to make it clear what i mean... https://www.youtube.com/watch?v=YpJf1eN ... e=youtu.be

if someone has experienced this before or has any idea or hints how to fix this, they are highly appreciated.

thanks in advance
rili
Posts: 3
Joined: Sun Oct 12, 2014 8:09 pm

Re: vehicle strange behaviour (with video)

Post by rili »

hi again,

i finally found the problem.

First issue:
As always the evil is the copy/paste thing. While trying to build an application out of two i defined the wrong broadcaster.

Instead of:

Code: Select all

btVector3 worldMin(-1000,-1000,-1000);
btVector3 worldMax(1000,1000,1000);
_broadphase = new btAxisSweep3(worldMin,worldMax);
I defined it as:

Code: Select all

_broadphase = new btDbvtBroadphase();
Second issue:
I had also problem with the wheels update. The position of the wheels was the interpolation of the chassis position between the actual and the past frame, resulting in the wheels positioned to some bias behind the chassis. The cause of this behavior was the following code:

Code: Select all

for (i=0;i<m_vehicle->getNumWheels();i++)
{
	//synchronize the wheels with the (interpolated) chassis worldtransform
	m_vehicle->updateWheelTransform(i,true);
	//draw wheels (cylinders)
	m_vehicle->getWheelInfo(i).m_worldTransform.getOpenGLMatrix(m);
	m_shapeDrawer->drawOpenGL(m,m_wheelShape,wheelColor,getDebugMode(),worldBoundsMin,worldBoundsMax);
}
After commenting out the m_vehicle->updateWheelTransform(i,true) or calling it with the second paramerer false, it all worked like it is supposed to.

This code was in the Vehicle Demo of Bullet samples. To be more specific it is the void VehicleDemo::renderme() in the VehicleDemo.cpp.

Can someone explain why should this method get called? I see that its purpose is to update the wheels, but the wheels have the updated position anyway when u call m_vehicle->getWheelInfo(i).m_worldTransform.getOpenGLMatrix(m);

thanks in advance.
Post Reply