I have to simulate a very heavy truck of 60 tons. At first i noticed the wheels were spinning, but the vehicle didn’t move noticeably. I tought that the tire longitudinal stiffness was too small to produce the force required to move such a heavy load. With higher tire longitudinal stiffness the vehicle moves fine, but the very high forces produced cause instability to the simulation and the vehicle scatters and doesn’t accelerate smooth. The more I reduce the longitudinal stiffness, the more the simulation is stable, but the more the wheels slip.
Are there other parameters I could tune in order to get my vehicle stable and smooth? Or should I reduce the weight anyway?
The documentation says that you should’nt use huge masses.
So this is perfectly normal behavior as PhysX is “just” a game engine.
I started with the vanilla car set up in SampleVehicle and modified it to handle a car of mass 60000kg. The vanillar car has a mass of 1500kg so I multiplied a few numbers by a factor of 40 to get the desired effect.
The first thing to change is the suspension. A heavy vehicle needs a stiffer suspension and higher damping rates than in SampleVehicle. A good starting point is just to multiply the strength and damping rate by 40. The idea here is to preserve spring natural frequency and damping ratio.
The next thing to change is the wheel mass and moi. SampleVehicle has a wheel mass of 20kg and a wheel radius of 0.5. I’d expect a 60000kg vehicle to have a significantly sturdier wheel than a 1500kg car. Let’s say that as a first guess we multiply wheel mass and moi by 40.
All of this brings us to the following modifications:
for(PxU32 i = 0; i < 4; i++)
PxVehicleSuspensionData suspData = mVehicle4W->mWheelsSimData.getSuspensionData(i);
suspData.mSpringStrength = 1400000.0f;// = defaultStrength * 40.0f;
suspData.mSpringDamperRate = 180000.0f;// = defaultDamperRate * 40.0f;
PxVehicleWheelData wheelData = mVehicle4W->mWheelsSimData.getWheelData(i);
wheelData.mMass= 800.0f;// = 20kg * 40.0f;
wheelData.mMOI = 100.0f;// = 20kg *0.5f *(0.5f * 0.5f) * 40.0f;
This change led to a stable car that accelerated and turned without noticeable wheel slip or any obvious artifacts.
There are a few further suggested changes. I would guess that a 60000kg vehicle would have fairly enormous wheels. The wheel moi shown above assumes a moi of 0.5m. It might be a good idea to increase wheelData.mMoi a but more to account for your wheel radius. You might also find the engine a bit weak. Typically, engine torque doesn’t scale linearly with mass (if it did we would see buses and trucks with the top speed of sports cars). Maybe try increasing the peak torque (PxVehicleEngineData::mPeakTorque) by a factor of 2 or so.
Hope this helps,