Vehicle Improvements in 4.5
The revision of our vehicle system has been a long time coming, and I am happy to say the wait will soon be worthwhile. The new system uses a hyperrealistic slip differencial system to adjust the power given to each wheel.
The results are a clear cut above any game vehicle physics you've ever seen.
I am also taking steps to make the vehicle system easier to use. The AddTire() command can now accept an entity as a parameter for the tire object. This would typically be a child limb found within a loaded car model. The object's size can be used to calculate the exact width and radius for the tire. This simplifies the vehicle setup code so you just load up the model, find the wheel limbs, add tires and axles, and build the vehicle:
//Load car model auto chassis = Model::Load("Models/Desert Patrol/Desert Patrol.mdl"); chassis->SetMass(2000); vehicle = Vehicle::Create(chassis); //Add tires vehicle->AddTire(chassis->FindChild("WheelFL"), true); vehicle->AddTire(chassis->FindChild("wheelFR"), true); vehicle->AddTire(chassis->FindChild("WheelBL14")); vehicle->AddTire(chassis->FindChild("WheelBL15")); //Add axles vehicle->AddAxle(0, 1); vehicle->AddAxle(2, 3); //Finalize the vehicle vehicle->Build();
It's very easy to load up a model and turn it into a working vehicle without worrying about the exact tire sizes and positions.
You no longer have to position the visible tire models yourself to match the tire orientations, as this is all done automatically. So we've taken a very complicated advanced system and made it very accessible and quick to get running.
- 3
11 Comments
Recommended Comments