Problem with Vehicle

xiaolizhi

12-07-2010 13:43:30

Sorry for my poor English.
I am learning OgreNewt. When I learned the demo05(SimpleVehicle), I have some problem.
1.The cars are too easy to move, it seems that there is not friction between tires and vehicle's main body, unless I use the my function:

void SimpleVehicle::setBrake(float value)
{
CustomDGRayCastCar* veh = (CustomDGRayCastCar*) this->GetSupportJoint();
veh->SetTireBrake( 0, value);
veh->SetTireBrake( 1, value);
veh->SetTireBrake( 2, value);
veh->SetTireBrake( 3, value);
}

2.How to reduce the shock of the tires?
3.The bigest Problem is that

void SimpleVehicle::setSteering (float value)
{
static float lastvalue = 0.0f;
if(fabs(lastvalue - value) > 1e-4)
{
CustomDGRayCastCar* veh = (CustomDGRayCastCar*) this->GetSupportJoint();
veh->SetTireSteerAngleForce( 0, value, 0.0f);
veh->SetTireSteerAngleForce( 1, value, 0.0f);
lastvalue = value;
}
}

I use it to make my car turn left or right. If the velocity of the vehicle is low, it works normally, but when the car go fast, it works very badly.

if (mKeyboard->isKeyDown(OIS::KC_A))
{
mCar->setSteering(0.52);
}
else if (mKeyboard->isKeyDown(OIS::KC_D))
{
mCar->setSteering(-0.52);
}
else
{
mCar->setSteering(0);
}

I use the code above to implement the steering of car.
I press the key A, the car turns left, then I release the key A. Logically speaking the car must go straightly, but it keeps turning left for a period, then goes straightly. The problem troubles me very mush.

Who has the sample of vehicle with ogrenewt?