Search Unity

FGear Vehicle Physics (v1.12 Released)

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

  1. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    hi,

    1-mirror is a game specific feature, you should roll your own, i can add a sample with a simple rtt.
    2-for 15-20 cars i think you will have more problems with rendering, cpuwise it should be no problem even with a budget device(with proper settings of course).
    3-yes, constantly working on improvements.

    also check the pdf documentation, available here : https://www.dropbox.com/s/tdbn0vr2d0sw2f4/unitydocs.rar?dl=0

    regards.
     
  2. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    a simple rewind & replay sample will be available in the upcoming release:

     
  3. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    v1.8 changes
    -rewind and replay sample
    -ability to drive on moving rigidbodies
    -new alternate bike script
    -bug fixes & improvements
     
  4. robert12342

    robert12342

    Joined:
    Jun 11, 2018
    Posts:
    29
    Hey, maybe you could make a build under Android?
     
  5. robert12342

    robert12342

    Joined:
    Jun 11, 2018
    Posts:
    29
    I would also be happy to see the deep profile screenshots . to understand how much physics is optimized
     
  6. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    there was an android build with the initial version but did not update it, i will upload an updated one.

    about performance a lot of people use the plugin and never heard of performance problems, anyone willing to comment on mobile performance?
     
    Last edited: Jul 2, 2020
  7. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    here is an updated android build.
     
  8. robert12342

    robert12342

    Joined:
    Jun 11, 2018
    Posts:
    29
    Hi dude, pls help me. Im build your scene
    on an empty stage, OK, as soon as I use something of yours, it comes out like this
     

    Attached Files:

  9. robert12342

    robert12342

    Joined:
    Jun 11, 2018
    Posts:
    29
    oh is bug unity v 2019.4.8 lts
     
  10. robert12342

    robert12342

    Joined:
    Jun 11, 2018
    Posts:
    29
    How about adding exhaust, low beam, turn signals in the future?
     
  11. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    checked the latest release(2020.1.2f1) and there seems to be no problem.

    i prefer focusing on physics instead of game specific features.
    i am a programmer and my art would seem terrible if i were to make visual effects like those.
     
  12. robert12342

    robert12342

    Joined:
    Jun 11, 2018
    Posts:
    29
    I have another question about photon, I understand that syncing is on the server and not on the client?
     
  13. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    yes, it is server authoritative but there is no client prediction.
     
  14. robert12342

    robert12342

    Joined:
    Jun 11, 2018
    Posts:
    29
    can you remove the authoritarian server? Or how can I rewrite it myself, it doesn't fit me =(
     
  15. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    server authoritative is the usual way(prevents cheating) and my plan is to improve that with client prediction.

    client authoritative on the other hand is useful in some types of games but it is also not easy.

    you can check this video for a good start :
     
  16. IggyZuk

    IggyZuk

    Joined:
    Jan 17, 2015
    Posts:
    43
    I'm curious is there a way to add arial controls? Something like in Rocket League (pitch, yaw, roll).
    Would you need to detect if all wheels are off the ground?
    Would it be sufficient to apply forces on the body of the vehicle, or is there a better way to do it?
     
  17. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    i think that would require a lot of experimentation and tweaking but i would definitely use forces/torques instead of manually transforming the vehicle.

    you may want to watch this video about rocket league, they talk about the physics of the vehicles:

    https://www.gdcvault.com/play/1024972/It-IS-Rocket-Science-The
     
    IggyZuk likes this.
  18. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    hi, i hope everyone is doing well and healthy in this troublesome days.

    v1.9 changes
    -new suspension constraint script
    -improved sticky tires
    -simplified network sample(client authoritative)
    -updated mobile sample scene
    -suspension relaxation damper option
    -clutch power scale option
    -bug fixes & improvements

    you can check the changeLog.txt file in Documentation folder for more detailed notes.
     
    robert12342 and IggyZuk like this.
  19. TiToMoskito

    TiToMoskito

    Joined:
    Jan 28, 2014
    Posts:
    66
    Hi tasadar, how are you?

    Did you removed the server authoritative example?
    And are there any plans to show maybe an example with client prediction?
     
  20. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    yes, i replaced it with a simpler client authoritative one because it wasn't working properly.
    to my experience its not possible to make proper client prediction with physx so if unity gets rid of physx and makes "unity physics" the default engine then we might work on a client prediction sample.
     
  21. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    v1.10 changes
    -auto clutch option added to transmission
    -fixed sequential gearbox bug
    -force symmetry option for tire models

    you can check the changeLog.txt file in Documentation folder for more detailed notes.
     
    IggyZuk likes this.
  22. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    Have the demos been updated to use the latest version at all?
     
  23. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    which version are you having difficulty with, i have tried 2020.1 without problems.
     
  24. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    No I am just wondering if the demos on the your website have been rebuilt using the latest version of the asset or if they use an old version?
     
  25. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    they are older versions but there is no dramatic change in dynamics so i do not feel the need to update them all. maybe it's a good idea to enable some never features and reupload the sandbox demo.
     
  26. TiToMoskito

    TiToMoskito

    Joined:
    Jan 28, 2014
    Posts:
    66
    Is it possible to load an saved config without replacing the wheel transforms?
    I would like to change runtime the vehicle config, for different race modes
     
  27. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    current save/load feature is for editor time and if you look at the save files there are no transform values.
    can it be used for game save/loads? not sure, i'll check it out inform you.
     
  28. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    @TiToMoskito i checked save/load at runtime and it starts to throw exceptions about transforms because when you load a vehicle wheel transforms(their references) are also loaded and if you did not manually assigned the wheel transforms they will be saved as null. when wheel transforms are not found, wheel class tries to find them by name at start so if you manually assign the wheel transforms and save then you can load at runtime. BUT you need to add more code to make it actually work because there are more places that needs to be recalculated like transmission.

    for ex. you need to call Wheel.checkMissingTransforms or call Transmission.refreshParameters after loading...

    so i added runtime save/load to my todo list, if you want to do it yourself i can assist you too, just drop a mail.
     
  29. ssaass227

    ssaass227

    Joined:
    Dec 27, 2020
    Posts:
    17
    hi, @tasadar I really like your implementation of the Ai system and the whole asset.
    I have a question, Can you please help?
    I am doing an app for mobile now, so I want to gain as much performance as possible by sacrificing accuracy and realism.
    The question is - is it possible to adjust "ComputeClosestParam()" or his dependents = to reduce precise calculations or insignificant (for mobile level game) processes? because it takes about 40% of performance and more.
    I've spent a week but still can't comprehend how it works. Even had thoughts to change Bezier Curve's type but I'm too new in coding.
    thank you in advance.
    fbdb.jpg
     
  30. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    the bezier curve class used for the ai script is a third party solution so i also do not have any knowledge about the code.

    you can try reducing calls to that function, for ex. call 5 times a second and interpolate between values.

    or you can write your own path system which could be based on line segments instead of a curve. it would be less precise but much more performant.
     
    ssaass227 likes this.
  31. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    v1.11 changes
    -convex casting option
    -wheel reaction forces
    -ability to turn engine on/off
    -tire models are converted to scriptable objects
    -ability to auto calculate wheel sizes
    -bug fixes & improvements

    you can check the changeLog.txt file in Documentation folder for more detailed notes.

     
    IggyZuk and ssaass227 like this.
  32. StudioTatsu

    StudioTatsu

    Joined:
    Dec 31, 2018
    Posts:
    10
    Outstanding update!!!
    You tackled many of the challenges of Next-Gen Wheels.
     
    tasadar likes this.
  33. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    thanks for pointing those problems out, there is always space for improvement :)
    i also admire your work, keep it up.
     
    Last edited: Sep 15, 2021
    StudioTatsu likes this.
  34. schaefsky

    schaefsky

    Joined:
    Aug 11, 2013
    Posts:
    90
    Hello, first of all, great car physics! I have bought 4 different car controllers, unfortunately yours was the last, would have saved me a lot of money.

    EDIT: it seems like the problem below is a low-ish gear ratio. If I raise (shorten) the gear ratio the problem gets better, also when I up the engine idle RPM.
    I think the actual cause is that there is no clutch simulation when you use Auto Clutch. I just tried with manual clutch and it works as expected. Manual clutching is just a bit hard with a gamepad :)

    However I have currently one problem with a car I set up from scratch, it does not really want to accelerate while under a speed of about 20km/h. Once I go faster everything seems to be working fine. Below that speed the engine is stuck at idle RPM and accelerates very slowly.
    Tried incresing tire grip, different tire models, changing mass, I must be missing something but I can not figure out what it is.
    It almost feels like you are riding the clutch the whole time until you reach 20km/h. I tried auto and manual (sequential) transmission, telemetry shows clutch at 100%.
     
    Last edited: Sep 27, 2021
  35. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    hi,

    your problem should be about insufficient torque at low rpm values, if you send me your save file it would be helpful to diagnose the actual problem.

    regards.

    ps. if you use mail for support, you may get faster responses, i check the forum once a day only.
     
  36. unity_44234FBC39E5661FBF5B

    unity_44234FBC39E5661FBF5B

    Joined:
    May 11, 2021
    Posts:
    29
    Does this have solid axle support?
     
  37. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    no, independent suspensions only.
     
  38. speedy19802

    speedy19802

    Joined:
    May 10, 2016
    Posts:
    53
    Hello, is this pyhsic still under development or no longer active
     
  39. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    it is active but no new features are planned only maintenance this year.
     
  40. speedy19802

    speedy19802

    Joined:
    May 10, 2016
    Posts:
    53
    Hello again but maybe you can help me. I'm trying to implement a tire temperature. when the tire is cold and becomes hot due to friction. and after the degree of hardness decreases and loses adhesion. Do you have an approach for me on how best to implement this, thanks
     
  41. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    pacejka tire model has no parameter directly related to temperature, MF6.1 has a pressure parameter but that won't be enough. i have no information about the physics behind temperature changes but what comes to my mind is you could go with 2 approaches. modify tire friction coefficients depending on temperature would be the easy way. or create different tire model variations for certain temperatures(for ex. one model for 5 degrees and one for 50 degrees) and interpolate between them.
     
    VermilionGames likes this.
  42. ssaass227

    ssaass227

    Joined:
    Dec 27, 2020
    Posts:
    17
    hi, @tasadar how are you, I have a small question -
    Fgear compiles in (Assembly-CSharp-firstpass) therefore my scripts located in (Assembly-CSharp) can't be referenced from Fgear scripts.

    if i move my 15-20 scripts to the plugin folder -
    is it somehow affect on performance in bad way?

    or it would be better to move fgear to a regular folder (not plugin)?
    I will be grateful for your opinion/solution. Thx
     
  43. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    I believe there should be no difference about performance, having separate assemblies helps to organize large codebases.
     
  44. virtualjay

    virtualjay

    Joined:
    Aug 4, 2020
    Posts:
    68
    I'm trying out this asset to include in an application I'm working on. However, this is for VR, with a variety of ways of doing input (including grabbing a virtual steering wheel and turning it), so it won't be reading from the normal keyboard/controller/etc. How can I force a value in for the steering and the brake/accelerator?
     
    Last edited: Aug 24, 2022
  45. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    you can follow two ways:

    1-provide parameters directly, you can check AIController.applyInputs function for an example.

    2-inject inputs to StandardInput. this has the advantage of still benefiting from this classes abilities. you can check MobileInput.Update function for an example. also you need to call StandardInput.setReadInputs(false) in order to make this work.
     
  46. virtualjay

    virtualjay

    Joined:
    Aug 4, 2020
    Posts:
    68
    This is what I tried that seeme dto work:
    Code (CSharp):
    1. vehicle.setSteering(/* value from -1 for full left to 1 for full right */);
    2. engine.setThrottle(/* value from -1 for full reverse to 1 for full forward */);
    Please correct me if this isn't the best way to go about it.

    What would the "classes abilities" be? Not sure what I'd be missing.
     
  47. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    that works for sure, this lets you provide raw input. here is a copy from AIController:

    Code (CSharp):
    1.  
    2. //apply inputs
    3. Vehicle.getEngine().setThrottle(EngineInput);
    4. Vehicle.getTransmission().setThrottleState(ThrottleState);
    5. Vehicle.setBraking(BrakeInput, false);
    6. Vehicle.setSteering(SteeringInput);
    7.  
    StandardInput provides extra filtering like dead zones, steering limiting, steering assist etc. you can read the documentation for details.
     
  48. virtualjay

    virtualjay

    Joined:
    Aug 4, 2020
    Posts:
    68
    By "steering limiting", are you referring to the Steering Limit Curve? I notice it still respects the maxSteerAngle.
     
  49. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    290
    yes, there is a steering limit and a steering speed curve and they respect vehicles settings of course.
     
  50. virtualjay

    virtualjay

    Joined:
    Aug 4, 2020
    Posts:
    68
    Thanks so much for the quick help. I'm running into a bit of an issue with reversing in my simple test.

    In start I'm calling
    Code (CSharp):
    1. vehicle.getStandardInput().setReadInputs(false);
    And then in Update
    Code (CSharp):
    1.             var gas = 0.5f;
    2.             var brake = 0f;
    3.             var steer = 0.5f;
    4.             vehicle.getStandardInput().setInputs(gas, brake, steer, 0.0f, 0, false);
    5.             // vehicle.getEngine().setThrottle(gas);
    6.             // vehicle.setSteering(steer);
    7.  
    This makes the vehicle go in reverse. However, if I comment out the setInputs line and uncomment he setThrottle/setSteering, it goes forward normally.