Early preview of Vehicle Physics Pro

UPDATE!
Follow @vehiclephysics on Twitter to get notified on news and updates regarding my vehicle physics projects.


I’m developing Vehicle Physics Pro, a new vehicle simulation package for Unity 5. In this post I want to let you know what’s the status of the development and what you can expect of this new package.

The development is actually at pre-alpha stage, with many parts already completed and working:

  • Base: tire model, physics solver, modular component design.
  • Tire Friction models: Constant, Linear, Smooth, Parametric, Pacejka simplified. To-do: Pacejka’94, anisotropic friction.
  • Differential types: Open, Locked, Viscous, Clutck-pack (Salisbury), Torque Biasing (Torsen).
  • Engines: Direct drive (constant torque), Inertial Drive (powered rotary mass) + Clutch. In progress: standard car engine.
  • Other: Torque Splitter (for AWD), Brakes, Reduction Gear. To-do: Gear Box, Torque Converter.
  • Standard bus for all components and external add ons to communicate together (inspired in the ODB-II standard).

The system is fully modular. Components are independent units with inputs and/or outputs that can be connected in any combination. Any vehicle setup can be emulated by arranging and connecting components.

This is an early development video showing the suspension and friction model only. Wheels are powered with a direct drive component each (constant torque, no differential nor drivetrain whatsoever). Ensure that annotations are enabled:

I’ve conceived, designed and implemented this vehicle physics simulation model from scratch. Everything in this model is absolutely coherent and provides realistic accurate results even with a single standard integration step (0,02 ms, 50 Hz). The system has been implemented around a true physics integration solver. The actual precision of the numeric results depends only on the integration method (Euler, RK4) and the number of integration substeps, which can be configured to any value, even dynamically, with very little and predictable overhead in the overall physics simulation.

Some insights on the components that are already working:

Wheel

TireInspectorThe wheel component provides accurate friction values under any situation. Many tire models fail at the steady state because they use equations that are not defined and/or become numerically unstable at low speeds. My tire model covers all cases uniformly and provides accurate and continuous transitions among adherent and sliding state at any speed, including steady state. Just as you’re used to see on real cars.

The friction curve can be anything from a constant coefficient of friction to Pacejka curves. Anisotropic friction will use my own friction combination method, which supersedes the classic Beckman’s method and its problems.

Another key point is the combination of the different torques acting in the wheel. The typical example is combining power and brakes. Most of times I’ve seen simulations that simply subtract the brake torque from the drive torque, but that’s not correct: drive torque pushes the wheel’s spin according to the torque’s sign; brake torque is signless, and aims to cancel any rotational speed; finally, the torque caused by the tire friction opposes the tire slip. My wheel component combines all torques resulting in the correct accurate tire forces and the exact wheel spin rate, as well as the correct feedback torque being routed upstream, in all situations.

EngineInspectorEngine

The engine component allows to easily model most engines accurately. It’s enough to specify the key rpms and torques, and configure the engine friction.

In this picture the circles are the torque and rpm values specified at the inspector. Then, according to the friction settings, the actual torque and power curves are automatically calculated. The result is a realistic engine curve that can be configured to match real specifications easily.

Legend:

  • Green: engine torque curve (Nm)
  • Blue: engine power curve (Kw)
  • Red: engine friction (Nm)
  • Dotted orange: raw engine torque w/o friction (Nm)
  • Circles: Rpm and torque values configured at the inspector
  • Horizontal scale: rpm x 1000
  • Vertical scale: torque x 100 (Nm)
  • Blue marks at vertical axis: power x 100 (Kw)

Differential

DifferentialInspectorThe differential component accurately simulates most types of differentials available. This includes the torque transfers among the wheels and back to the drivetrain, as well as the rotational side effects. For example, in an open differential, when a wheel is rotating while the other is in the air (and the engine is stopped), then the wheel in the air rotates in the opposite direction but the same rate as the grounded wheel. This same happens in my simulation even given that it hasn’t been explicitly coded: it’s just a natural consequence of the simulation design.

Supported differential types and actual models:

  • Open: Standard open differential.
  • Locked (spool): Forces both wheels to rotate at the same exact rate.
  • Viscous: limits the difference of rotational speed among the wheels.
  • Clutch-Pack: Salisbury, Limited Slip (1-way, 1.5-way, 2-way), Powerflow, Torque-Lock, VariLock.
  • Torque bias: Torsen, Quaife, Truetrac, “torque biasing / torque sensing” differentials.

Other components

The Torque Splitter provides a way for routing specific amounts of torque on demand, in the same way as the Audio Quattro transmission does.

The Reduction Gear is just that. Specify a ratio and you get the corresponding torque and rotational effects on that drivetrain line.

Brakes trigger the friction torque at the wheels, which is correctly combined with all other torques and the correct behavior and effects are accounted. For instance, braking a wheel in one side of a differential causes the expected rotational and torque effects in the wheel at the other side.

All components have a common base class, so you can develop and use your own components easily.

The data bus is a standard method allowing all components, the vehicle system and the external add-ons to communicate together. This method is inspired in the ODB-II standard. As example, the rpm value is published in the data object so any other component or add-on can read the value and do whatever it wants with it: display the rpm at the dashboard, implement a shift light, cut the engine power above certain value…

 

Frequent answers I’m being asked for

When will this be released?

I expect Vehicle Physics Pro to enter the beta stage by January 2015. Hopefully a fully working version will be available for the release of Unity 5.

The development is actually at pre-Alpha stage. Most of the core physics are implemented, but I don’t think it’s suitable for being used in actual projects because things are likely to change during this stage.

Licensing, prices and discounts

I’m planning the standard license to be around $100 (Asset Store), and offer a professional add-on license for $200 (bonus contents, GIT repo access, skype support).

Actual users of the old Vehicle Physics package will have a discount when purchasing the new pack. Depending on whether the Asset Store allows promotions at the time of the release or not, I’ll offer the discount at the standard license or at the professional add-on license.

Is this written in C# or will be a C# version available?

This package is entirely written in C#.

Will it work on Unity 4 – Unity 5?

Vehicle Physics Pro works perfectly in both Unity 4 and Unity 5.

What about developing a project with vehicles in Unity 4 but moving to Unity 5 later?

Given the actual state of Vehicle Physics Pro and Unity 5 at this moment (Nov 2014) my best advice is:

  1. Stay with Unity 4.6 and use Edy’s Vehicle Physics (the old package) for prototyping only. Do not develop actual vehicle behavior nor gameplay yet.
  2. Update to Vehicle Physics Pro when released. This will require a bit of adaptation: the way for communicating with vehicles (send control, gather data) is slightly different but very intuitive and easy to use. Also, many new features are available (gearbox, transmission types…). Still, any well-designed code should be straightforward to adapt.
  3. Now you can choose among staying in Unity 4.6, moving to Unity 5 now, or moving to Unity 5 later. Vehicle Physics Pro will work the same in both versions, maybe with minor specific adjustments if any.

What are the plans about the old Edy’s Vehicle Physics package?

Unfortunately Unity 5 breaks the compatibility with the old WheelCollider component, so the old vehicle physics package no longer works in the new version.

The WheelCollider in Unity 5 is a totally different component. My actual package configures the WheelCollider for fixing a specific design flaw present in the Unity 4 component, so it causes issues when applying those settings to the different WheelCollider in Unity 5. At this time, I can only recommend to use the old Vehicle Physics package in Unity 4 projects.

 

Have more questions? Have suggestions? Feel free to leave a comment and I’ll be happy to reply!