Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Edy's Vehicle Physics - official thread

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

  1. BusterTheWizard

    BusterTheWizard

    Joined:
    Jul 2, 2012
    Posts:
    51
    Interesting, this may be easy to integrate then. RCC does use friction and constantly adjusts it, that and many classes all individually trying to access info about the wheel collider are what make integrating it a pain. Sounds like EVP would be a lot easier to do it with. I'll give it a shot, if I figure it out I'll share it here for others.
     
    Edy likes this.
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,523
    For a "compensating fifth wheel" coupler, you are correct. A "standard" fifth wheel coupling on many trucks will not include rotation on the axis parallel to the travel (Z). The whole trailer will tilt a little if the tractor tilts, like hitting a curb on the right side. Small amounts of twist is absorbed in the suspension at each axle.
     
    Edy likes this.
  3. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,361
    This is extremely interesting. I always assumed there should be some rotation parallel to the travel, but what you said makes total sense. Thanks!
     
  4. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,523
    Edy, do you have advice on making an EVP vehicle a little less prone to getting out of control when all you have are on/off inputs? Keyboards and the L/R triggers of a Switch Pro controller aren't proportional, so I'm finding it hard to get the right lerp magic to get up to a good moderate speed (below the vehicle's own max speed) and similarly for WASD steering. More Lerp and less Lurch but not horribly slow to get motion too.
     
  5. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,361
    If you're using the VehicleStandardInput component, then all the "lerp magic" is configured in the standard Unity input settings. Check out the recommended settings here:

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

    With these settings in the horizontal and vertical axes, vehicles with good settings are pretty fun to drive (at least the example vehicles included in the package).
     
    halley likes this.
  6. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,523
    Yeah, it wasn't the physics parameters or the purpose of the brake/throttle/steering parameters that confused me. But I see your VehicleStandardInput input code (and your commented block re: a better continuous forward/backward handling), and that gives a good insight on how to handle that.
     
    Edy likes this.
  7. Homicide

    Homicide

    Joined:
    Oct 11, 2012
    Posts:
    636
    Hey Edy. This could be a pretty dumb question to vehicle gurus, but that i am not. Is it possible to get a rough estimate of horsepower for any one given vehicle, as it is now, i only really see max drive force as a viable property for the general power. But for eg: 5000 to max drive force doesnt really translate to much i recognize.

    I suppose i could do some fake maths and come up with a number (i did recently check out a few sport cars . horse power etc for comparisons) but still, the numbers in the end didnt seem to match up.

    Im not sure what numbers i should be crunching, but i did locate this equation.
    Power = Force * Distance / Time.

    UPDATED: Disregard, i managed to crunch some numbers and find what i needed. Ty.
     
    Last edited: Mar 14, 2023
  8. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,570
    Can you share the answer? Your question seems like a good one. :)
     
  9. Homicide

    Homicide

    Joined:
    Oct 11, 2012
    Posts:
    636
    Yea, sure, but bare in mind,

    #1 a vehicle guru i am not,
    #2 a math genius i am not..
    #3 this is not a true formula for HP, the real formula would be Force(#Pounds) * distance / time. But i still havent wrapped my head around how to work in the vehicle weight, and frankly, the results i am getting are really close to what i would expect based on my general browsing of vehicles.

    That said, i did manage to find what appears to work for me (i only needed a semi believable value to represent my vehicles, as they are not realistic to begin with.)

    If you take the max drive force, multiply it by 100 (Neuton) and divide it by 735.49875, it will result in a semi believable value. Do be ware, that the max forward speed may or may not need to be adjusted over all as well to compensate for your increased / decreased power, as they are indepenent properties.

    If anyone else comes along and sees this, and IS a math / vehicle wiz, i would appreciate any tips on how to truly aquire any result even more accurate.
     
    hopeful likes this.
  10. Homicide

    Homicide

    Joined:
    Oct 11, 2012
    Posts:
    636
    I now have another question Edy. Is there any way you can provide some additional information on exactly what, and or how, a few settings work.

    Mostly, im interested in the GearDownRPMRate, GearUpRPMRate, and their relation to gearUpRPM, gearDownRPM, IdleRPM, and maxRPM.

    Obviously, the latter four are fairly self explanatory, but exactly what is those Rates doing in this picture.

    Cheers.
     
    Last edited: Mar 17, 2023
    Crossway likes this.
  11. noio

    noio

    Joined:
    Dec 17, 2013
    Posts:
    217
    I have a question about driving uphill in Edy's Vehicle Physics (EVP) package for Unity. I'm finding it difficult to model uphill driving realistically because there is no gear shifting in EVP. As force in EVP depends on speed and not on internal RPM, I'm not sure how to accurately simulate uphill driving for a vehicle.

    When I say 'accurate' I don't mean fully realistic. I just find it tricky to model a single Force Curve Shape (incl Max Force & Max Speed) that gives satisfying behavior both on flat land while still being able to drive uphill at all. If I bias the curve to give high force at low speeds, the car drives uphill fine but it accelerates way too fast on flat land, and vice versa.

    Would manually swapping the Force Curve Shape when detecting an uphill drive be a possible solution? Essentially, this is modeling a gear shift.

    Alternatively, should I consider switching to VPP? I'm really happy with EVP's abstraction level and would prefer to stick with it if possible.

    Any advice or suggestions would be greatly appreciated. Thanks in advance!
     
  12. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,523
    I thought I was going nuts for a bit (maybe I am). Tried to add EVP to a forklift but the forks wouldn't collide with anything. Finally came to figure out that all the colliders on the fork mast had been moved to layer 2, and that I could avoid that branch in the logic by setting my wheel update mode to "Fast." All the code looks like the layer 2 ("Ignore Raycast" by default) stuff should just be done for brief moments, but something is not restoring them as they should be.
     
  13. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,361
    Those define the rate of change of the engine audio pitch when gear is switched down or up.

    A higher rate makes gear shifts sound more "abrupt", like in sports cars, while a lower rate makes them sound more smooth, like in family cars with automatic transmissions.
     
  14. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,361
    Actual force in cars depend in both the engine and the gearbox. Having to gear shifts up means each gear provide more speed but less force than the previous one.

    As a result, typical realistic force curves have this kind of shapes (shape < 0.5):

    upload_2023-4-7_12-23-45.png

    This provides good acceleration and speed on flat ground, but will force the car to decrease the speed on uphills in order to gain some more force.

    Remember that the curve is heavily related with the maximum speed setting (meters per second) and the aerodynamic drag, which prevents the speed to actually reach the given max speed.
     
    noio likes this.
  15. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,361
    That might be a bug, will take a look at it.
     
  16. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    501
    How can I record car movements?
     
  17. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,361
    Most reliable method is storing position, rotation and inputs each fixed update. If you also want to restore the state from an arbitrary state ("flashback"), you should then include velocity and angular velocity.
     
  18. TwentyOneGamesStudio

    TwentyOneGamesStudio

    Joined:
    Jul 10, 2020
    Posts:
    5
    What is the use of FollowHeading.cs Script in of Edy's Vehicle Physics, For what Purpose we can use it?