[NxOgre 0.9] wheel friction problem:car can not stop

kidcdf

29-04-2008 07:54:04

In the example of Lesson701, the car can not stop as soon as it launches. so I rewrite the codes:
"wheelShapeDesc.wheelFlags = NX_WF_EMULATE_LEGACY_WHEEL;"

// Create the default material
NxMaterial* defaultMaterial = gScene->getMaterialFromIndex(0);
defaultMaterial->setRestitution(0.9);
defaultMaterial->setStaticFriction(0.5);
defaultMaterial->setDynamicFriction(0.9);


In Physx2.73 api manual, it says:
In the legacy friction model the output from the tire force functions is ignored. The combined material properties of the wheel and the "ground" determine the traction budget

then the car can stop after drives for servel seconds.

But in NxOgre 0.9:
NxOgre::SceneParams sp;
sp.setToDefault();
sp.floor =true;
sp.gravity=NxVec3(0,-9.8,0);
sp.defaultMaterialDynamicFriction=0.9;
sp.defaultMaterialRestitution=0.9;
sp.defaultMaterialStaticFriction=0.5;
m_nxscene = m_nxworld->createScene("BumperCarPhysxScene", m_sceneMgr, sp);


NxOgre::WheelParams wp;
wp.setToNormal();
wp.suspension_damper = 1.0f;
wp.suspension_spring = 20000.f;
wp.suspension_target = 0.02f;
wp.suspension_travel = 0.01f;
wp.radius = 0.6f;
wp.inverseWheelMass = 0.1f;
wp.emulate_legacy_wheel=true;
wp.clamped_friction=false;

car->wheelset = WheelSet::createFourWheelSet(car->body, Vector3(-1.0f, -carsize.y/2, 1.8f), Vector3(1.0f, -carsize.y/2, -1.6f), wp.radius,"",wp);


the car still can not stop,why?

then I add these physx codes to set the EMULATE LEGACY Model manually. run the game, add some motoe torques,the wheels began to run, but the car didn't move,I have set the mass of car to 1.0,and all
SceneParams.defaultfriction = 0.1 ,but it still doesn't work.
for(std::list<NxOgre::Wheel*>::iterator i = car->wheelset.Drive.items.begin();i != car->wheelset.Drive.items.end();++i)
{
(*i)->getNxWheelShape()->setWheelFlags (NX_WF_EMULATE_LEGACY_WHEEL);
}

kidcdf

29-04-2008 11:54:37

no one knows?
how to make the friction valid in order to stop wheel running?

korupt

29-04-2008 12:04:57

Posted: Tue Apr 29, 2008 6:54 am
Posted: Tue Apr 29, 2008 10:54 am

Come on man...

kidcdf

29-04-2008 12:30:28

Posted: Tue Apr 29, 2008 6:54 am
Posted: Tue Apr 29, 2008 10:54 am

Come on man...

what's wrong

betajaen

29-04-2008 12:43:03

Because if you think I'm going to get out of bed to answer your post, then wonder why I didn't four hours later. Your wrong.

kidcdf

29-04-2008 13:25:40

ok,i am wrong ,I just want to get the answer

kidcdf

30-04-2008 03:20:47

Bejajaen,would u please help me about this question,it really confused me for a long time

luis

30-04-2008 10:05:26

kidcdf:
Search in the forums! vehicles is a very common topic...
I'm using bleeding 1.0-18 but these two post will help you if you're begining with vehicles:
I suggest you to read my first post in page#1 and my last post in page #2
http://www.ogre3d.org/phpBB2addons/view ... ng&start=0

Then, for the jittering and grip FPS dependent, read:
http://www.ogre3d.org/phpBB2addons/view ... +jittering



and, forget about NX_WF_EMULATE_LEGACY_WHEEL and materials, use tire functions.

kidcdf

04-05-2008 09:15:42

Now,I am using tire friction model,there are my settings:

NxOgre::WheelParams wp;
wp.setToDefault();
wp.suspension_damper = 0.5f;
wp.suspension_spring = 20000.f;
wp.suspension_target = 0.01f;
wp.suspension_travel = 0.01f;
wp.radius = 0.6f;
wp.inverseWheelMass = 0.1f;

wp.input_lat_slipvelocity = true;
wp.input_long_slipvelocity = true;

wp.longitudal_tire_extremumSlip = 1.0f;
wp.longitudal_tire_extremumValue = 0.02f;
wp.longitudal_tire_asymptoteSlip = 2.0f;
wp.longitudal_tire_asymptoteValue = 0.01f;
wp.longitudal_tire_stiffnessFactor = 10000.0f;

wp.lateral_tire_extremumSlip = 1.0f;
wp.lateral_tire_extremumValue = 0.02f;
wp.lateral_tire_asymptoteSlip =2.0f;
wp.lateral_tire_asymptoteValue = 0.01f;
wp.lateral_tire_stiffnessFactor = 10000.0f;


Question 1:
************
Then I tried to change stiffness dynamiclly in each frame,when longitudal_stfifness = 0,the ground seems like the ice, and when lateral_stiffness = 0,the tire's steering is invalid, yes,that's all right.
stiffness between ground and wheel provides the driving friction,but it obviously not provides damp friction, while the car is driving straightly, whatever the longitude stiffness is, the speed of car doesn't change.

Question 2:
***********
The speed of car declines a lot when it turns around, in my guess,the lateral stiffness makes an "damp" effect when the wheel turns. So I set the lateral stiffness to a low value,likes 500, the "Slow turning" phenomenon disappeares, but the wheel just slides on the ice and almost can not turn around.


I am puzzling again ,Is there anything I miss?

luis

04-05-2008 15:51:58

No, dont change the stiffness dynamically...
to your two questions, this is my advice:
1- setup the car, the weight, damper/springs etc and all the physics parameters correctly.
2- use tire functions and use Physx's defaults in the function
3- set the flags: NX_WF_INPUT_LAT_SLIPVELOCITY and NX_WF_INPUT_LNG_SLIPVELOCITY in all wheels
4- drive !
5- tune up only the stiffnessFactor untill you're happy with the response.

kidcdf

04-05-2008 16:01:03

thank u for reply.

In Physx's demos,once the car launches it can not stop unless using brake, so there is not a successful example for me till now. I think a whole code snipps will be helpful

luis

04-05-2008 19:31:47

In Physx's demos,once the car launches it can not stop unless using brake, so there is not a successful example for me till now. I think a whole code snipps will be helpful


To accelerate the car you set motor torque and if you want to brake the car you set brake torque. Both parameters are independent from each other and no FPS dependent so you set it and forget.
But if you want to simulate a deceleration due to the friction/motor you could set some kind of minimum value for the brake torque in order to have some constant 'friction'.

Car simulation is a hard topic.... and you need a lot of 'know how' to make it fun and realistic at the same time (although both things are incompatible).

And dont forget anti-sway or your car will roll on each corner.....

BloodyFanatic

05-05-2008 11:16:53

@kidcdf:
read AND understand that before posting anymore stupid questions:

http://phors.locost7.info/contents.htm

these papers should answer all of your questions ;)