Jump to content
  • entries
    943
  • comments
    5,899
  • views
    924,397

Vehicle Improvements in 4.5


Josh

3,973 views

 Share

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.

17634312_10154987760341183_2545546855562571217_n.png.e07fcedc55d8782cb027516383cf8f0f.png.8891f7de3a1add7ad1ad131afee0408b.png

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.

Image1.thumb.jpg.5c1011351b709c6bb7a61ffa35da56ae.jpg

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.

  • Like 3
 Share

11 Comments


Recommended Comments

2 minutes ago, Olby said:

Cool. But can it beat BeamNG.Drive ? :D

Not on crumpling of the body, at this time.  On the vehicle driving physics, yes.

Link to comment
3 hours ago, jen said:

Is it available now on the latest 4.5 beta release Josh?

Thanks.

No, and it doesn't presently drive at all, just steering wheels and brakes.  Julio and I are working on it.

  • Like 1
Link to comment

Thanks for the update.   I've tried to do a driving game a couple of times and found it a bit frustrating, so this sounds like a significant step forward. 

Driving game or VR game for xmas competition....hmmmm......driving AND VR maybe?  :) 

 

 

Link to comment
Quote

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.

What does this mean for vehicles where the wheels were not limbs of the car model? i assume that it will still require us to set the visible tire matrix to the physics tire matrix?

Link to comment
15 minutes ago, macklebee said:

What does this mean for vehicles where the wheels were not limbs of the car model? i assume that it will still require us to set the visible tire matrix to the physics tire matrix?

Your assumption is wrong dear Macklebee.  All it requires is that you pass it an entity.  It matters not from whence it came.

For backwards compatibility the original AddTire command is left in place, and it will create a pivot and pass that to the new interface.

Link to comment
20 minutes ago, Josh said:

Your assumption is wrong dear Macklebee.  All it requires is that you pass it an entity.  It matters not from whence it came.

For backwards compatibility the original AddTire command is left in place, and it will create a pivot and pass that to the new interface.

Okay, please explain how that will work. The new AddTire appears to be just using an entity and the steering parameter with no reference to position or rotation of the tire since its being assumed that the tire is already a submesh of the model and correctly aligned. So If I use the new command with separate car and tire models, how does it know where to place the pivot? And the old AddTire() has no reference to a separate tire entity, so how do you make the relationship between the physics and visual tire with the old command?

Or is this relationship built inside the editor by manually placing the tire models in the correct position/rotation and also placing tires as children under the car model parent in the scene browser?

Link to comment

@macklebee An entity that is not a child of the chassis also has a position and rotation.  You just put your tires where you want them and the routine will calculate their relative position and rotation to the chassis.  They can be a child of the chassis or not, all that matters is their position and rotation in global space.

If you use the old command you will still need to align your tires yourself.  This override will disappear from the documentation and just stay in the engine to keep older games working.

  • Like 1
Link to comment

Ok, so you are saying whereever the individual visual tire models are positioned/rotated at the time of their inclusion to the new AddTire() thats where the pivots/axles will be created. Sounds good.

Will the new AddTire() also have adjustable parameters for tire size, suspension details, friction, etc? 

Link to comment
6 minutes ago, macklebee said:

Ok, so you are saying whereever the individual visual tire models are positioned/rotated at the time of their inclusion to the new AddTire() thats where the pivots/axles will be created. Sounds good.

Will the new AddTire() also have adjustable parameters for tire size, suspension details, friction, etc? 

Yes, all the same parameters are there.

  • Like 1
Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...