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!

Updated: 2014.12.03 — 18:49

47 Comments

Add a Comment
  1. In C#, awesome.

  2. I was about to purchase the old Edy’s asset, since I was waiting for it to appear on a discount on the asset store.. but after seeing this, I think I will wait for January. ..

    But I have a question that concerns me… will be possible to exist a “early bird” discount release or pre release on the asset store?

    Sure, I can say that, I will not buy it unless it appears on any offer event or is on discount :p

  3. Discounts will be available for actual customers of Edy’s Vehicle Physics. These discounts will assume you’ve paid the full price ($60), even if you’ve got the pack at this sale’s price ($18). You could consider the ongoing sale as a discount on both packs (BTW, only 2 days left 😉 ).

    I can’t tell if there will be further offers.

  4. I’m having a problem with manual gear shifting, because looks like this is unavailable at least on version 4.4. Will this be fixed to the new version of Edy’s Vehicle?

  5. Yes. A fully working gearbox component will be available out of the box in the new package.

    Previous versions don’t emulate the gearbox because in Unity 4 reducing the torque at the wheels triggers a bug in the WheelCollider causing the tire to lose sideways grip. Yes, true.

  6. This is a really good new!

    I’d like to know if in this version you will also decouple the input from the class CarMain so I can use my custom input script, that can be a drive wheel, a keyboard, or touch buttons.

  7. Hi Edy,

    Will you make comments in English? I had so much hard time in the old package to understand the comments.

    And also, support for drive wheels and clutch would be great.

  8. Yes, yes and yes.
    Code is in C#. Comments are in English. Drive wheels and clutch are both simulated.

  9. Hi Edy,

    Looks truly brilliant! Couple of questions:

    1. Does this model support trailers? So, is it possible to have this model calculating trailer wheel behavior (1 axis or more), while the trailer body is connected to the car with spring joint or so?

    2. Wheel behavior on different terrains. Is it possible to adjust the wheel behavior regarding on which material it is currently traveling on? So, if one cars right wheels are on grass and left ones on sand, is it possible to have different wheel behaviors accordingly? If so, can Unity’s object tags be used for this for different surfaces?

    3. Mobile development. While having full vehicle physics is awesome, do you have any estimations how will it do performance-wise? Or on the other hand, will it be possible to disable some extra functionalities to have smoother core experience on hand-held devices?

    Had already a blast with you current Vehicle physics package, really looking forward for this! Have fun while developing!!

  10. Many thanks!

    1. Yes. The vehicle controller supports several setups out of the box. One of them is “passive vehicle”, with any number of axles. This vehicle setup simulates the brake circuit only (no engine etc).

    2. Absolutely. A contact patch” class includes the contact data per wheel, including the surface grip and drag.

    3. Yes. Each vehicle setup simulates only the components required. For instance, a 4×4 car requires three differentials while a regular car uses one. A passive vehicle such as a trailer doesn’t need anything but brakes. You can also develop your own custom vehicle controller using exactly the components you need, in the way you want.

    The precision of the simulation can also be fine tunned by specifying the amount of substeps for the vehicle simulation solver. The minimum recomended value is 2, but everything is designed to work correctly (but less precise) with a single substep (= 1 Unity physics step). I’ve experienced that up to 4 substeps can be used without causing overhead.

  11. This will be great, I’m so excited to have it with unity 5.

    Can we also simulate 2 or 3 wheel objects? (motorcycle etc)

  12. Three wheels will be fine. Motorcycle requires a further physics add-on. I plan to develop it, but won’t be in the first version.

  13. Pingback: Black Friday sale!
  14. Sounds amazing!! Also, those motorcycles would be interesting add-on for sure (avid biker myself in real-life), some additional physics with centrifugal forces caused by spinning wheels or so. Wikipedia has decent page about those dynamics:

    http://en.wikipedia.org/wiki/Bicycle_and_motorcycle_dynamics

    But, like you said, better to focus on implementing the core mechanics on four wheels first, as motorcycles are a whole different story. 🙂 Thanks for your thoughts, have fun developing!

  15. Nice page for motorcycle dynamics! I have my own design draft, but the page gives also a couple of additional hints. Thanks!

  16. It looks very realistic.

    How does it behave when the vehicle is driving upside down, with contact maintained by centrifugal force?

  17. Exactly as it should.

    Gravity is not involved directly in the calculations. The wheel simulation takes the force coming from the suspension and turns it into tire force according to the tire simulation model. The suspension force can come from weight (gravity), centrifugal force, sporadic contacts in zero-g, or any other situation you can think of.

  18. Hi Edy,

    Will the new Pro version for Unity 5 have the option for easy arcade style vehicle handling?

    We’re having some issues converting our existing WheelCollider codebase to Unity 5’s WheelColliders.

    Thanks

  19. First version will focus on the core simulation to be realistic. Arcade behavior will be developed later as add-on. Everything will be working in Unity 5.

  20. Hi
    I want to develop a drift game form android , is current package or new one have some configuration for dirfting game ?
    Thanks & Best Regards

  21. In the current package other users have achieved drifting settings by tweaking the parameters.

    In the new package it should be relatively more easy, as it’s much based on real settings and components are realistically simulated. Thus, the procedures and settings for real drifting cars would be also applicable to simulated cars.

  22. Will you be implementing axle movement on this? I am referring to the rotation angle of the back wheels toward one another. Most vehicle physics will have the back wheel straight and never angled towards each other, but the correct way with an axle would be to angle the wheels toward one another because they are both attached to the same axle.

    Also any ETA on release?

  23. Not sure on what you are referring to with “axle movement”. Can you point me to a video or picture describing it?

    About ETA, my plan is to have a working version ready for Unity 5 launch. Thus, as soon as Unity 5 enters the release candidate stage I’ll take all that I had at that point and begin finishing and packaging it.

    Vehicle Physics Pro should be ready to be used in production at the beta stage. I’d estimate about 1 month ahead. At the beta stage the core components will be stable enough for production. Then I’ll keep developing new components and features until the package is completed (or Unity 5 enters RC stage, whatever happens first).

  24. Hey eddy bought your physics package a few months ago and it’s working fine with PC but i want to run it on my android now,so my android device is responding to your physics but with external keyboard,i can’t find anything in carmain.js or in carcontrol.js.Please tell me what to do to make it work with touch system on android.Thanks

  25. Brian, please write me to edytado@gmail.com and I’ll be happy to assist you. Include the invoice number.

  26. Hello,I was gonna make a race simulator with the old eddys vehicle physics package I bought long ago and now this one comes out.If I couldve had this one in the store before buying the other one i wouldve bought this one wich I think is no fair.I heard you will give a discount but I’d like to know about how much I would have to pay for the package with discounts applied.I dont have a budget so all the money I had went into the old one.

  27. If I could have finished this package long ago, I would have released it then 🙂 (I’ve been working on it for nearly 4 years now)

    I plan to discount $30-$40 (to be decided) when upgrading to the new system. This will be at least the 50% of the old package. 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.

    The actually planned license prices are exposed at the documentation page:

    https://vehiclephysics.com

  28. With unity 5 being released, do you have any plans to release it soon? Thanks Lewis.

  29. Hi Edy,

    Have you played Reckless Racing? How easy will it be to setup a vehicle with Vehicle Physics Pro with those sort of easy going physics with easy drift?

    Thanks

  30. I haven’t played that game, but Drift Max uses Edy’s Vehicle Physics and has nice drift settings.

  31. When will this be available on the asset store? I’m going to start working in a project right now

  32. I expect the final version to be released around September-October.

  33. Alpha to Omega

    Make it free XD

  34. Edy, hi…
    I’ve got a question. I’m planning on buying this for my game. My game is totally not arcade-ish, it’s based on survival and realisticness. So i’ll have vehicles, and what i was thinking, is it possible to make the vehicles work with clutch, manual shifting, engine stalling and everything to make it real-life like to drive it, well a little bit easier sinice keyboard doesen’t have floats in input but instead 0 which is unpressed and 1 which is pressed, that is ints only. But you get the idea, i’d like to have a shifter pattern in the corner, UI part, and you can use your mouse to change gears there… Waiting for reply… Thanks.

  35. @Ricky Absolutely. This video was recorded using the keyboard only. You can also try the vpp demo using the keyboard. The only problem might be the clutch, but it could be solved by “tapping” the clutch key.

  36. Edy,
    um thanks, but in the demo… It’s not manual at all, i just have to hold W and it changes gears itself, also wierdly it sometimes stays in one gear, stops chaning automatically, and the engine is about to explode (not really but you get the point xD), but it doesen’t stall which is…Noooot really realistic is it ?

  37. also, i can’t turn the engine off

  38. never mind i can turn it off with ctrl + k

  39. Okay um, i like the demo overall but first of all it’s not automatic and pressing page up/down doesen’t seem to change that… Second, i’d like the clutch to be required and for this to be much more realistic when it comes to stalling an engine… Is it possible ? And can i adjust the throttle’s pressment not to be from 0 being unpressed completly, and 1 being pressed all the way up, engine would also stall irl if we did that wouldn’t it ? I’ll rather make a sliderbar as a little ui part and so the players slide the bar a little bit, and then when you hold the W key it will slowly get from unpressed to pressed to where the slidebar is set to… Even if it’s set to max, the throttle will slowly get pressed more and more to the max when we’re holding w, and also for it to depend on speed so the speed of pressment is faster if we’re going fast… Or do you have a better idea :/ ? Forcing people to use axis controllers would be… Bad, wouldn’t it ?

  40. I can explain better if i’m not clear btw, and sorry for the spam.

  41. It’s completely realistic, but the demo is configured to be fun to play with. Everything can be configured to your liking (take a look at the inspector screenshot here). The car in the demo uses an uncommon setup: manual gearbox, auto-shift and a torque converter instead of a clutch. A torque converter allows a nice power control even with keyboard, making difficult to stall the engine. In addition, the auto-shift won’t allow to engage gears in situations where it could be stalled.

    If the auto-shift is disabled (an upcoming version of the demo will have an option) the engine could be stalled by reverse-engaging the coupling in the torque converter. If you know how a torque converter works, you will realize that the coupling depends on the difference among the angular velocities at both ends. The more difference, more coupling (locking). You could put the vehicle in reverse and gaining some velocity. Then suddenly engaging the first gear will stall the engine. I’ve just tested it in the project here. Tell me if that’s not realistic! 😀

    About the gearbox staying in first gear: this is how some real automatic gearboxes work. They won’t switch to second gear until the vehicle has reached some speed (current setup is 25kph / 15mph). This is for preventing the gearbox to engage gears when the wheels have limited traction (i.e. over mud or snow). A nice side effect is that you can do crazy burnouts even with auto-shift engaged 😉

    Feel free to mail me to edytado@gmail.com.

  42. Haha now you’re hitting me with some physics sh*t i have no idea what you’re talking about XD Kiddin i know most of the stuff you said, i understand… I ment the gearbox to be manual though, so you have to switch gears yourself using a clutch too. Okay so overall, it’s possible to make a really realistic driving experience right ? If so that’s okay.
    But btw do you have any idea on how should i make keyboard users make the pedals not pressed to max when the button is held if you know what i mean. Like if i hold W it gives full gas which would just stall an engine and even demage it. Sinice keyboards are not axis based like joysticks and such controllers, how would i approach this problem ? Do you have any idea for me ? Or maybe you can make everything i want in a demo and have a nice demo showing how realistic your product can be besides it’s arcady side. We don’t have any driving realistic games out there anyways ! Come on please give it a shot.

  43. Hakan Karaduman

    Hi Ricky, you can create a float variable and make it bigger if the user presses W or Up Arrow button by multiplying it with Time.deltaTime. This will give you a gradually increasing float value just as a joystick axis.

  44. Yeah man i know, but that wouldn’t do the trick completly, i need a much better and realistic aproach on this one.

Leave a Reply

Your email address will not be published. Required fields are marked *

Confirm that you are not a bot - select a man with raised hand: