Search Unity

FGear Vehicle Physics (v1.12 Released)

Discussion in 'Assets and Asset Store' started by tasadar, Dec 18, 2018.

  1. virtualjay

    virtualjay

    Joined:
    Aug 4, 2020
    Posts:
    68
    FYI, this is an automatic transmission with only a forward and reverse gear.

    While digging around trying to solve the above problem, I found this in the manual:
    Auto Clutch: When set to true the transmission automatically manages the clutch input for you. Set this to true if you want to manually operate the clutch.​

    Should that last sentence say "Set this to false"? It seems like that's the logical conclusion.
     
  2. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    it shouldn't happen, i've tried it in mobile_race scene and it works fine.
    check if anything changes the gear before you start.
     
  3. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    yes, that's a typo, thanks for the warning.
     
  4. virtualjay

    virtualjay

    Joined:
    Aug 4, 2020
    Posts:
    68
    I figured out the problem. I had set the LimitRPM to 2000, trying to simulate how this heavy industrial vehicle operates. There's probably a better way to do that, but it's odd to me that setting it this way made it go in reverse.

    On a related note, I find that if I set the Mass above about 2000 kg, the vehicle immediately falls through the floor collider. I assume this is because it's pushing the tires through the floor. In real life, the vehicle does way about 3200 kg, while being smaller in dimensions than a compact car. I wonder what the best way to do it is. Sadly, I'm not really that knowledgeable about that stuff. I do have these specs, if it's any help:

    upload_2022-8-25_10-16-48.png

    upload_2022-8-25_10-17-3.png

    upload_2022-8-25_10-19-3.png
     

    Attached Files:

  5. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    limiting rpm has no such effect but if you provide a large friction torque then engine can generate negative forces so keep an eye on your parameters.

    8wdMilitarySample in the sandbox scene is 7500kg so mass has no effect about your problem. you can inspect its parameters, it's also a heavy duty(kind of) vehicle.
     
  6. virtualjay

    virtualjay

    Joined:
    Aug 4, 2020
    Posts:
    68
    To be clear, I didn't change anything else. I added the Vehicle script and set the Limit RPM to 2000 and set the axle 0 Max Steer Angle to 30 and pressed play, with JUST the lines of code I've shown you. I just tried deleting and re-adding the Vehicle script to confirm that. It goes backwards.
     
  7. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    yes, it's the same thing, if you reduce engine friction torque to 10 then it won't happen.
    this is not a problem if you properly configure the engine but it might be safer to prevent this so i'll add this to my todo list.
     
  8. virtualjay

    virtualjay

    Joined:
    Aug 4, 2020
    Posts:
    68
    I just dropped the 8wdMilitarySample into my scene and attached the script on it with the same result. However, I noticed something interesting on both it and my original vehicle. Values for the throttle above about 0.55 would make it go forward. Values lower than this (but still positive) would make it go backwards.

    Since setInputs() is an undocumented function, what are the expected values for throttle and what do they mean?
     
  9. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    add this line to the very end of Engine.myFixedUpdate

    Code (CSharp):
    1. if (mTorque < 0 && mThrottle > 0f) mTorque = 0;
    we are kinda spamming the forum, please drop a mail to lazybitgames@gmail.com from now on.
     
    virtualjay likes this.
  10. CircusCharlie

    CircusCharlie

    Joined:
    Jul 22, 2014
    Posts:
    38
    Hello, I am facing a weird issue. When I press the button for throttle, the tyres rotate but the car does not move forward. This started happening after I moved my folders from one project to another. - Please help me, thanks
     
  11. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    replied via mail.
     
  12. Aimbotstudio

    Aimbotstudio

    Joined:
    Jul 3, 2020
    Posts:
    2
    Hi ! i'm using F- Gear and want to achieve drifting just like FR legends but the vehicle physics is bit different in F-Gear package any one could help me out with this how could i achieve this ??
     
  13. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    didn't play that game but my guess is that these type of games activate a drifting state with a player input and run a special drift assist code in addition to regular vehicle sim and leave that state when certain conditions are met. the problem to solve is to find out how much and at which direction these custom forces/torques should be applied based on player inputs and (probably) the curvature of the current road segment. that requires an analysis of the movement of a drifting vehicle, some math knowledge, creativity and may be a lot of trial & error. I don't think anyone can direct you to the finish line here so you need to get your hands dirty.
     
  14. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    a couple of projects using fgear, hopefully there will be more with unity:

     
  15. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    v1.12 is available now
    • Reworked powertrain
    • Custom gravity option
    • Sleeping (auto/manual)
    • Impulse based hard contacts
    • Rev-matching option for transmission
    • Stall assist option for clutch
    • Spacer offset option
    • Simple cruise control with a PID controller

    Detailed notes and all the changelog can be found in the pdf documentation.
     
  16. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Can you elaborate about this a bit, does this also include support for multiple contacts?
     
  17. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    sorry, I forgot to explain this in the change log, it relates to the "Hard Contact Scale" option which is demonstrated in the constraint.scene. the previous solution was creating a configurable joint per wheel which wasn't working well and relatively expensive. we manually calculate the required impulse to resolve the suspension penetrations, it is much cheaper and stable when you have a reasonable setup.
     
  18. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,764
    Are the demos updated to use the latest version or are they using an old version?
     
  19. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    only the sandbox demo(sandboxdemo8) is up to date others are using older versions.