Vehicle Physics Pro latest updates

After having dedicated some time to Edy’s Vehicle Physics (with great results!), I’m now giving a push to Vehicle Physics Pro. Early Access licensees, this is of interest to you!

I’ve committed several updates these days:

Gravity hack removed

You should now remove all VPGravity components from your scenes (you’ll see an Unity error otherwise) and configure gravity normally in the project. The VPGravity script is now a static class for managing gravity in vehicles. It also caches some extensively used values, such as the magnitude and the Up direction.

VPP-gravity-hack-removed-2

VPP in Unity 5 was using a hack for ensuring the WheelCollider suspension to work correctly. This hack consisted in setting global gravity to zero, then manually imposing the gravity via Rigidbody.AddForce. Now I’m using a different approach that doesn’t require this hack anymore. Now the suspension force is not applied in a strictly correct way (will be in Unity 3D 5.2+), but this change is barely noticeable.

Any gravity direction and magnitude is now supported

VPP-gravity-direction-marked

VPP now supports the gravity to be in any direction and magnitude. The only requirement is either modifying the global gravity using VPGravity.value, or calling VPGravity.Refresh() after modifying Physics.gravity yourself. As a static class, you can invoke VPGravity properties and methods anywhere in your code.

New sleep mode for the wheels

VPP-handbrake-hill-steady-marked

This improvement keeps the vehicle completely steady when parked on hills or slopes, even when only some wheels are braked or another object is pushing it. The typical situation is the vehicle being parked on a slope with handbrake applied only, as seen in the above pic: only the rear wheels are braked and applying force, yet the vehicle is perfectly steady at the slope.

New parameter for tweaking the wheel simulation model

A new parameter tireImpulseRatio configures the magnitude of the force that keeps the tire adherent. Previously VPP used a hard-coded value of 0.5, which worked in most vehicles.

Lower this parameter if the tire forces get numerically unstable when the vehicle is resting or under external loads. Ideally, the best value for this ratio is the higher value where the tire forces are stable. These forces tend to become unstable at vehicles with raised center of mass, and/or supporting external loads. In most cases you can leave the default 0.5.

What’s next

Next immediate step is fixing a known bug related to clutch torque and integration substeps. I think this is a priority as it might involve significant adjustments in other components that calculate progressive torque ratios such as the automatic gearbox and the torque splitter.

Things to do before entering the Beta:

  • Refactor the code for using namespaces instead of “VP” prefixes.
  • Prepare the 3D assets for deploying. They all should be in FBX format. The repository should include a “source” folder with the original Blender files.

Vehicle Physics Pro is in alpha stage, but I’m offering Early Access to the development repositories. Mail me to edytado@gmail.com if you’re interested.