Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Edy's Vehicle Physics - official thread

Discussion in 'Assets and Asset Store' started by Edy, Jan 19, 2012.

  1. wmaass88

    wmaass88

    Joined:
    Dec 23, 2012
    Posts:
    45
    Anyone have any tips on the best way to simulate wet or icy road reaction?
     
  2. serberusno1

    serberusno1

    Joined:
    Jan 28, 2017
    Posts:
    84
    +1 for me. Adding a physic material with less friction does nothing seemingly
     
  3. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    Simply write an script to enable and disable the VehicleNitro component based on your criteria.

    You may convert the foreach loop in a for() loop if that's easier for you, but that requires basic scripting knowledge.

    Vehicles expose the input properties directly (steer, throttle, brake, handbrake) so you may simply modify them from your mobile UI.

    The VehicleStandardInput component just reads the input from the Unity's standard Input class. You may modify the sensitivity and gravity properties for the Horizontal axis there for changing the turn rates. Here are the default values recommended for EVP:

    https://evp.vehiclephysics.com/faq/#how-to-configure-the-input-parameters
     
  4. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    The provided Ground Material Manager prefab provides different ground materials: asphalt, offroad, sand... Vehicle wheels don't react to the physic material properties, but to the settings defined in the Ground Material Manager present in the scene.
     
  5. BrightBit

    BrightBit

    Joined:
    Jan 22, 2013
    Posts:
    255
    Hi Edy,

    on April 2016 you've posted on twitter that you would also add the VPVehicleJoint component to EVP 5 (non pro) but there's still no VPVehicleJoint component, is it? Did you change your mind?
     
  6. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    Many things changed since then and that's no longer planned, sorry. The plan now is including some articulated vehicle example (truck + trailer) using the standard Configurable Joint.
     
  7. BrightBit

    BrightBit

    Joined:
    Jan 22, 2013
    Posts:
    255
    That's still good news then. :) I just would like to create cars with trailers or snake busses as you did. Do you have a rough estimation for when you might be able to release this example?
     
  8. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    Sorry, I don't have an estimation. As soon as I could get some 3D truck model I could use in the package would be a valid guess :)
     
  9. Aleksa_Djordjic

    Aleksa_Djordjic

    Joined:
    Oct 28, 2017
    Posts:
    6
    Hi , i am having a bit of a problem setting up the vehicle. Everything is working fine but the wheel transform is ..... weirdly manipulated by the VehicleController script.

    (Ignore the top part , it is my 2nd monitor)

    Screenshot (121).png

    The wheel colliders are rotated 90 degrees off on the Y axis , but as far as i know , your script should fix that ?

    Here are more images of my vehicle setup : https://imgur.com/a/wFEZ16Y

    Thank you !
     
  10. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
  11. Aleksa_Djordjic

    Aleksa_Djordjic

    Joined:
    Oct 28, 2017
    Posts:
    6
    Ok , thanks
     
  12. Aleksa_Djordjic

    Aleksa_Djordjic

    Joined:
    Oct 28, 2017
    Posts:
    6
    I will tomorrow , it is 1am over here , again , thanks i will
     
    Edy likes this.
  13. Aleksa_Djordjic

    Aleksa_Djordjic

    Joined:
    Oct 28, 2017
    Posts:
    6
    *Note : I sent you an email , and i have tried with some other models and all of them work just fine exept this one ...

    I tried making a pivot for the wheel and then rotating it in the opposite direction of what the wheel was but it still doesn't work , not it is 90 degrees off at the x axis
     
  14. GamePyro-com

    GamePyro-com

    Joined:
    Jul 28, 2018
    Posts:
    197
    Hello

    i saw you asset are there good way to use / get it working like at for example GTA 5 handling etc

    and when cars lying at the rooftop that they can turnaround like in GTA that can drive again and not ned get out of car only when its to much damaged ?

    and crashing and exploding cars

    regards
     
  15. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    A generic mesh deformation component is provided for simulating damage. This component exposes several damage parameters you may use to measure the damage level of the car. Also, handling and performance is degraded when the car takes too much damage (try the online demo)

    The other features (turnaround, exploding) are project-specific, and are not implemented in EVP demos.
     
  16. GamePyro-com

    GamePyro-com

    Joined:
    Jul 28, 2018
    Posts:
    197
    ok you have demo or so for tutnaroubd or will you implement ?
     
  17. sTorrr

    sTorrr

    Joined:
    Oct 28, 2018
    Posts:
    128
    Hi, I want to replicate the “TrackMania Nations” arcade like car game with the power-slide effect that happens after entering a turn full speed and then pressing break while still holding down the throttle and turn. I have tried “Randomation Vehicle Physics 2.0”, but I find this one to be too realistic as well, in terms of how the vehicle reacts when siding. I think too much friction, especially on the front tire relative to the rear. In addition, I am not sure if it is a difference in weather or not I am speeding while breaking. The car does an instant 90-degree slide before stopping. Any tips on my journey?

     
  18. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    yeah.... finally made the purchase & will be taking Eddy for a test drive in coming hours..

    Can someone recommend good Driving Ai for chase cars ?
     
  19. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    jump in Eddy...
     
  20. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
    Anyone test EVP with 2018.3? Just wondering if there are any issues with Physx upgrade?
    Thanks
     
  21. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    I've been using EVP in 2018.3 since the first betas and it works perfectly. You'll only find some auto-generated files as result of the terrain upgrades.
     
    devotid, MoribitoMT and GreeneMachine like this.
  22. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Need a little help. :)

    Im trying to add some rigidbodies to the trunk of my vehicle that weighs 1000 units of weight. Nothing crazy at all. Just a simple four wheeled regular vehicle. I copied a vehicle right from the truck example. When I add the weight of 1 single newspaper (1 unit of weight simple rigidbody with a single box collider) in the trunk it acts like there is 10,000 lbs in the trunk. The vehicle will move but it will spin the wheels like its on ice and cant get any speed.

    Do I have to parent the "currently loaded items" to the vehicle for this to work? I saw in a video or two that you could just drop a load on the truck and it would handle it with the suspension. Im using Unity 5.6.3 I fully understand how the suspension works I just dont understand why this is not carrying the load.

    Maybe something to do with the "Disallow runtime changes". I am setting the COG from a gameobject.

    Cant think of anything else.

    Any help is greatly appreciated.

    Kevin
     
  23. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    It should work the same no matter you parent the object or not. Rigidbodies control the component's transform in world space so parenthood relationships are ignored.

    In the demo scene one of the trucks begins with a rigidbody in the trunk. You may press E to make that rb "jump" and see how the truck reacts to the additional weight.

    I recommend you to use the demo scene as starting point. If you can reproduce the issue then please write me to the support email and I'll investigate possible solutions.
     
    devotid likes this.
  24. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Ok. I spent over a full day on this now. but I think I am getting closer.

    I tried the demo scene again and I replicated the "problem" that I am having. If you take the BigStone Gameobject in the demo scene and turn it to 45 degrees and move it a bit forward and above the rear of the cab. Then hit play and you will notice that the vehicles perceived mass in the telemetry is about 75% of the vehicle's weight. ie; its being pulled upwards and making the vehicle very lightweight and unloading the suspension and impossible to drive.

    The problems seems to be that unless the gameobject is flat or at a "certain angle" it will not work properly. You can drive the car a bit forward and hit the E key and the box will flatten out and act as normal (perceived weight 1500 units). But if you get the gameobject to rest at a certain angle it will "lift" the vehicle.

    As you can see in the photo the perceived weight is ~750 lbs on a 1000 lbs vehicle.

    Angled Block.jpg

    In my game I have a golf cart that is built from the Red Demo truck. Nothing abnormal at all. (I have been using Edy Physics for around 5 Years on 3 different commercial games... so I am very familiar with vehicles and your software.) Unless the "Payload" objects on the vehicle are at a certain angle the vehicle will be undrivable. Now imagine that there is 20 papers in the back of the golf cart there is no way it will work.

    Here is a video showing me setting simple Rigidbody game objects in the back of my golf cart and you can see the perceived mass is correct only 1 out of 5 tries. If the Gameobject is laying non parallel to the ground than it usually never works. In the second half of the 1:50 second video you can see your demo vehicle prefab doing the same thing as my golf cart.



    I am trying to not parent them to the golf cart because I want them to be able to fly out of the cart if there is a bad driver at the wheel.

    Thank you
    Kevin
    devotid
     
  25. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    @devotid thanks for the detailed report! I've tried to reproduce the issue without success. All my attempts ended with the car's perceived mass being 1500 kg. I've tested in Unity 2018.3.0, 2017.4.17 and 5.5.4.

    Have you modified the EVP scripts in some way, or there's some non-EVP component modifying the wheel properties? Maybe something around the vehicle substeps? (WheelCollider.ConfigureVehicleSubsteps).

    Please note that the EVP code configures the properties of the WheelCollider in a very specific and detailed way in order to tweak the underlying PhysX wheel component so it behaves as a proper wheel. Any change around the code that configures the WheelCollider in EVP may bring the PhysX bugs and issues back.

    Also, have you made any changes to the properties of the physics materials included in EVP?

    I'd recommend you creating a new empty project, then downloading and installing a fresh copy of EVP from the Asset Store, just to be sure that the problem can be reproduced in an unmodified EVP copy.
     
    devotid likes this.
  26. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Well I started a fresh project per your instructions and with only edy physics and fixed the problem. I had the "Enable Adaptive Force" set to true in the Edit/Project Settings/Physics panel and that is what is causing it. I needed it for other parts in my game. So to reproduce the problem you have to check the "Enable Adaptive Force" and then it will work like my example and lift the back of the vehicle.

    I am using enable adaptive force in my game as it helped to stabilize a couple of the coin machines that have a bunch of rigidbodies (coins). I will see if I can change this at runtime or I will figure a way to make the machines stable without it.

    FoundIt.jpg

    Long story short: TURN OFF Enable Adaptive Force in the physics menu if you see the problem that I was experiencing. I am Using Unity 5.6.3 as this is a 1.5 year old project that is almost done and will not be updated to 2018 yet.

    tl;dr Dont use Enable Adaptive Force

    Also: THANK YOU so much for your contribution to Unity "Vehicles and the community". I have seen you doing wonderful things for people and devs over the last 5 years and it does not go unnoticed. Guys like me get to make fun games with vehicles with your hard work. I learned a lot from your blog and wheel colliders info years ago and it really helped me. So thank you and I plan on purchasing your Pro software someday when I get back into vehicle sims again.

    Thank you again Edy. Merry Christmas.

    Kevin
    devotid
     
  27. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    From the Unity PhysX 3 Release years ago:

    "To start with something simple, we’ve made the adaptive force switchable and off by default. Adaptive force is a special technique in PhysX to compensate for numerical errors when simulating stacks. However, feedback from Unity developers tells us that adaptive force contributes a lot to overall instability in game content. Expect your stack-like things to behave better in future."
     
  28. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    Wow! I've reproduced the issue in Unity 2018.3. It happens exactly as you describe. I'll post a warning on twitter about the Enable Adaptive Force option. Many thanks for your time figuring this out.

    Also, thank you so much for the kind words! I'd love to see the games and projects you're using EVP at. Feel free to post them here or on twitter. Merry Christmas to you too!
     
    devotid likes this.
  29. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    No problem at all. :) Do you know of any way to turn the Enable Adaptive Force option on and off at runtime? I cannot find anything on it. I tried to use some of the machines in the arcades without it and it was not good. lol.

    this is the only thing that I could find..... https://docs.unity3d.com/ScriptReference/Physics-gravity.html
     
  30. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    There's no possibility of changing Enable Adaptive Force in runtime. The flag is part of the PxSceneFlags enum in PhysX. It's stated that this flag is not mutable and must be configured at scene creation. It's understandable that it produces weird side-effects, as it's explicitly defined as a "crude hack".

    The only future chance is the flag being exposed when creating separate physics scenes in Unity 2018.3+. If this happens, then your case would fit nicely in this feature: the machines would "live" in a physics scene with Adaptive Force enabled, while the rest of the world would be simulated normally. However, being realistic I wouldn't expect this to happen before Unity 2019.
     
    devotid likes this.
  31. maxaud

    maxaud

    Joined:
    Feb 12, 2016
    Posts:
    177
    I’m looking to have a top down camera that doesn’t stay behind the vehicle but still follows it. Is this sort of implementation supported or would it break anything?
     
  32. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    I haven't tested, but you may tweak the orbit camera parameters to stay on top of the vehicle and ignore the mouse input.
     
  33. n7796ja

    n7796ja

    Joined:
    Jan 16, 2019
    Posts:
    2
    Hi, I'd like to purchase this asset, but I have one question.
    Does this asset have a trailer truck coupling function?
    Thank you for a great asset!
     
  34. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    Hi, and welcome to Unity forums!

    No, that function is not included. However, you may rig truck + trailer separately as two vehicles, then use a joint to couple them.
     
  35. n7796ja

    n7796ja

    Joined:
    Jan 16, 2019
    Posts:
    2
    Thank you for your reply!
    Can you freely connect and disconnect by using a joint, or do turn signals operate in conjunction?

    I will use this asset to create games like ETS 2.
     
  36. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    You should write your own script for that, but yes, it's perfectly possible. Just create a joint for connecting both parts, and remove it for disconnecting. You should ensure the junction points are close enough before creating the joint to prevent sudden impulses.
     
  37. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
    Hi Edy
    How do I disable the self correction when vehicles roll over... I am creating some offroad terrain, and when the vehicle rolls onto its side, its trying to upright itself.

    I also have some sideways sliding going on when a vehicle is at rest on an angled terrain.. until the vehicle feels its in a more comfortable position! Its like it is making very very slow adjustments to its position, until its balanced. Could this be anti roll or uprighting itself kicking in also?

    Thanks
     
  38. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    @GreeneMachine Those issues are ultimately caused by PhysX (the underlying physics engine in Unity). There are some workarounds available with different implications depending on the approach. Please write me to edy@vehiclephysics.com for support.
     
  39. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
    How can I change the speed of steering? It turns too fast I need to make it slower to looks more realistic.
    No one can turn a steer that fast :eek:
     
  40. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    Crossway likes this.
  41. JhonRA22

    JhonRA22

    Joined:
    Jan 15, 2019
    Posts:
    2
  42. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
  43. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    The G920 is supported as it modifies the Unity's standard input (Horizontal and Vertical axis). However, there's no clutch nor manual shifting support. EVP is focused to gameplay and ease of setup, so the vehicle is just configured in terms of acceleration, top speed, handling etc.

    You may want to take a look at my other vehicle physics simulation kit, Vehicle Physics Pro. In this pack all the vehicle components are accurately simulated and may be configured using real-world specifications. Logitech G27, G29, and Thrustmaster T500RS are supported out of the box. An easy to use DirectInput API is included so any other wheel may be supported by simply adapting the mappings.

    Surely it's supported, or it would be very easy to use it. The Vehicle Controller component exposes the input as normalized properties: throttleInput, brakeInput, steerInput. As long as Rewired can modify a property in a standard Unity component, then Rewired can be used with EVP.
     
  44. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    I dont know why but I keep having the wheel colliders "disappear" on me randomly when parking my golf cart. I will exit the vehicle and it will be resting on the axles and tires are dug into the ground as if the wheel colliders are missing.

    When I exit the vehicle I mark the RB as Kinematic, set the ebrake and only turn off the Audio Script component. The vehicle sits there with all the stuff on. It takes hardly any cpu juice so i dont mind. But when I come back to the cart it looks like it's sitting on the frame.

    I have the Disable Runtime Changes and Disable the Steer Correction Ticked.

    Any idears or does this sound familiar?

    Thanks edy.

    Oh and for the problem I had with the "Enable Adaptive Force".... I just fixed it with a large collider on the cart marked as a trigger and then when they put something into the "cart trigger" it would just parent it to the vehicle and mark it as Kinematic. Seems to work just fine. I have to mark the vehicle Kinematic when parked because if not.... the vehicle will react to the things i set in there (through the sprung mass) and then when i put the keys in and drive away the Perceived mass will not match the actual mass and we all know what happens when that happens. Lots of DONUTS. lol.

    So im still tinkering and debating upgrading the project to 2018 and mess with the other idea of different physics in different scenes if that is even a thing yet.

    I got my newest game out on steam today and the Golf cart is made with Edy's Physics. So simple to just drag and drop an easy to drive car into the scene, plug in my input system, adjust the suspension to replicate the cart and DONE. :) https://store.steampowered.com/app/598980/The_Coin_Game/
     
  45. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Just open the Edy physics input script component and do what it says to do in the "Convert any Script to Rewired" in the Rewired Docs. Its like One line of code to make it work. Guavamans Docs are some of the best out there.

    http://guavaman.com/projects/rewired/docs/HowTos.html#converting-scripts
     
    Edy and guavaman like this.
  46. ShinuToki

    ShinuToki

    Joined:
    Apr 11, 2015
    Posts:
    1
    Hello Edy,

    First of all I want to clarify that I don't own this asset myself, but I tested the online demo and it looks very good. However it seems to be a bit too much arcade for me (just like GTA games), is it possible to change it inside the asset?

    Thank you!
     
  47. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Yeah there is all kinds of easy sliders for weight transfer, Front/rear bias, grip multis, Drift modes etc. Thats what makes this package soooo good is that in minutes you can have a simple F1 car or a Rock crawling baby buggy. He has broken auto dynamics into simple effective bits that you choose with sliders. Its like an Equalizer on a old clarion head unit for vehicle creation. Move slider get easy result.
     
    Edy likes this.
  48. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Edy Im still having the wheel collider disappearing into the ground. Any suggestions?

    More info in post #994 a couple spots up.

    You can see it happening here in a youtube video from GrayStillPlays @2:59 and 6:11 Im sure there is an easy fix.
     
  49. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,477
    Can you share some screenshots of the golf kart in the Unity Scene window with all the colliders and WheelColliders visible? Feel free to send them by email. Without further information, it looks a collider vs. WheelCollider positioning issue.
     
    devotid likes this.
  50. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    OK I might have found the culprit and I should have checked sooner. I have a large single box collider around the whole cart marked "trigger". But it is on the same layer as the cart and the wheel colliders "default".... and as you can see in the pics in encapsulates the whole cart. The problem I think is that the large collider DOES NOT cover the mounting point (Starting Point/ Wheel Mount Position) .... Hence it works on load because the wheel collider is out of the box trigger....and then will quit working when the a arm is almost fully compressed and then it (the wheel Collider) will go up into the large collider and never return back "out". Making it look like the tires fell off. That sound about right?

    But you would think that the wheel "mesh" would update position to wherever the wheel collider is right? Hence i should see them up inside the wheel well.

    It also explains getting hit by other cars and why they would stop working then.... because they got blasted and fully bottomed out and were up inside the collider and never came "back out"

    Im going to try to make the trigger collider a few pieces to allow wheel well clearance and see if that makes a difference. Ive never had this happen before with any of the examples or any of the edys cars so IM SURE it on my end.

    TL;DR Dont put your wheel colliders just outside of a box and then hit a big bump cause they wont come back out. (as they were mistakenly on the same layer and colliding)

    Ill report back.

    GolfCart2.jpg Golf Cart 3.jpg GolfCart1.jpg