Search Unity

FGear Vehicle Physics (v1.4 Released)

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

  1. Lesnikus5

    Lesnikus5

    Joined:
    May 20, 2016
    Posts:
    60
    I see that you also updated the demo. Wonderful! It seems that because of my question, you added boxes to the back of a pickup truck. It's nice. :)

    By the way, I found a small bug. If the car is turned on the roof and the wheels do not touch the ground, they continue to rotate endlessly, and the speedometer shows about 6-9 km / h, depending on the type of car.

    In general, physics still looks better compared to most similar assets. Driving sensations remind me Driver 2-3, in which I really liked to just ride around the city. One feels that a lot of effort has been spent on the tire slip model.
     
  2. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    thank you, i will continue improving the mechanics.

    and the up-down case is not actually a bug, if you switch to neutral gear the wheels will stop. actually the car should always travel in first gear but i prevented it.
     
    Lesnikus5 likes this.
  3. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,420
    Good day, I'm evaluating a new physics package for my top-down racing game SuperTrucks Offroad, and so far I'm liking what I've seen in the demos.

    Just some questions..

    1.) Would this package be a good fit for offroad conditions with lots of bumps/jumps?

    2.) When I drive against the side of a wall in the demo, the vehicle just completely stops instead of driving/sliding along the wall like a normal vehicle would, is this configurable?

    3.) Are there any platforms that have not been tested? Such as WebGL and Windows Store? My game is on both so this platform support is required.

    4.) Does the game support IL2CPP builds on Android?

    5.) What is mobile performance like, would 8 vehicles run fine on an Android device from a few years back?
     
  4. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    hi,

    1- i watched your games videos and i can say that it would be just fine to use fgear.

    2- that must be the colliders shape, if you use a convex shape that resembles the vehicle and tune friction settings of the physx system, you can get what you need.

    3- i have not tested them yet but this package is pure c# and it should run on any platform. i will test the webgl build and inform you.

    4- yes.

    5- should be no problem but i will also test it and inform you. i have a lenovo k6 note which is a bit old hardware that seems like a good reference.
     
    Meltdown likes this.
  5. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    tested on WebGL with no problems.

    tested android with my lenovo, 10 vehicles(5-10 substeps), it is smooth.
    i do not think you will have any problems with cpu time unless you increase raycast count for 3d wheel effect.
     
    Meltdown likes this.
  6. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,420
    Thank you very much for the responses and for checking platform compatibility for me :)
     
  7. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,420
    @tasadar Sorry a couple more questions around vehicle configuration...

    I have the following upgrades in my game...

    Engine (top speed)
    Exhaust (acceleration)
    Tyres (tyre grip)
    Suspension (more tightness of suspension means less bounciness over bumps)
    Nitro (Nitro boost)

    Basically a player will start with a slow vehicle, and as they upgrade it gets faster, accelerates better, takes corners tighter, less bounce over bumps, and they can upgrade nitro.

    Are these all configurable settings I can play with in your package?
     
  8. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    Engine (top speed) -> you can adjust with altering gear ratios
    Exhaust (acceleration) -> you can adjust with altering engine torque, gear ratios or a couple more settings can also effect this
    Tyres (tyre grip) -> you can directly alter it or you can create different tire models
    Suspension (more tightness of suspension means less bounciness over bumps) -> directly adjustable
    Nitro (Nitro boost) -> there is no built in feature but can be easily implemented as a temporary engine boost.
     
    Meltdown likes this.
  9. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    i've just uploaded latest versions of touring and sandbox demos(using upcoming version 1.2)
    links are in the first post and legacy demo links are still available in store page.
     
  10. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    v1.2 changes
    -updated differential implementations
    -separate axis mode option for throttle, brake & steering
    -drift mode option for OrbitCamera script
    -nitro effect demonstration for Effects script (press N in race scene)
    -bug fixes & minor improvements
     
    Lesnikus5 and Vagabond_ like this.
  11. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    903
    Something about proper ForceFeedback some time soon ?
     
  12. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    i have not decided what to work on for the next release, can not say soon but eventually ;)
     
  13. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    v1.3 changes
    -improved ForceFeedback script
    -fake motorcycle setup(with BikeHelper script)*
    -bug fixes & minor improvements

    *motorcycle setup behaves poorly in 50hz, minumum 100hz physics rate is recommended.
     
    Lesnikus5 and Vagabond_ like this.
  14. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    903
    Hi, is it possible to use the "ForceFeedback" with other wheels than Logitech models as well !?
    I will guess that it is not - but just in case !

    Thanks !
     
  15. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    honestly i have no idea.
    probably it wont work with others, if you get a chance to try it out, please let me know.
     
    Vagabond_ likes this.
  16. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    There is a bug preventing skidmarks from showing up.

    comment out or remove the below code(line 362 in Effects.cs)

    Code (CSharp):
    1. mSkidFL = mSkidFR = mSkidRL = mSkidRR = -1;
     
  17. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    version 1.4 is on the way, will be probably released this month.
     
    Last edited: Aug 14, 2019
    Lesnikus5 and user099 like this.
  18. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    Lesnikus5 likes this.
  19. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    257
    Hi ! Considering purchase of this awesome asset; would it be possible to have access to documentation and possibly a WebGL (or Mac) demo of the simple scene ? Thanks !
     
  20. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    hi, drop me a mail and i will forward the documentation : lazybitgames@gmail.com

    i will also upload a webgl demo somewhere and share its link here...
     
    DiscoFever likes this.
  21. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    257
    Sent ! Thanks !
     
  22. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
  23. Doughtinator

    Doughtinator

    Joined:
    Aug 8, 2019
    Posts:
    10
    I'm interested in your asset, so far in my research I think your demo feels the most solid and believable to drive without being overly-simulate to make the vehicles hard to drive with simple controls.

    How easy would it be to use your asset in a multiplayer environment, how difficult would it be to sync other player vehicles over network (UNET or PUN etc) including skid marks and other effects.

    Many Thanks!
     
  24. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240

    hi, there is no reason to say that fgear is multiplayer friendly or unfriendly. it is no different then replicating a wheel-collider based vehicle.

    if you plan to replicate user input and hope to get the same output on the other side then i do not think so unless you make a lock-step system. on the other hand if the effects do not have to be precise then it might be possible.

    i am currently in the stage of making a todo list for the next version 1.5 and a multiplayer sample could be a good candidate.
     
  25. Doughtinator

    Doughtinator

    Joined:
    Aug 8, 2019
    Posts:
    10
    Excellent, thanks for the quick reply!

    Yes the idea is just to sync positions/states across network, not player input.

    I am excited to hear you are considering a multiplayer sample!

    Thanks again
     
  26. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    v1.4 changes
    -new MF6.1 tire model
    -scalable moment effects of wheels(Mx,My,Mz)
    -tire pressure parameter(works only with MF6.1)
    -added option to enable/disable each wheel
    -terrain texture based friction sample(varying_grip.scene)
    -an additional car model included
    -bug fixes & minor improvements
     
    Lesnikus5 likes this.
  27. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    903
    Hi, thanks for the update. It is always good to have updates :)
    I gave it a try. Just wondered how to test this new MF6.1. If i drop the prefab in a scene and disable the previous one i get errors for adding wrong force to car body !?

    Thanks !
     
  28. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    hi, thats a bug thanks for discovering :)

    for the time being instead of disabling the other tire model you can just select the new tire model from the list or just delete the previous one from the scene.

    s1.jpg

    there are also new parameters available, Mx and Mz are only effective with the new tire model but their effect is very small and mostly unnoticeable.

    s2.jpg

    and to make sure you are using the correct tire model you can check the telemetry gui:

    s3.jpg
     
    Vagabond_ likes this.
  29. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    903
    Great, thanks for the info :)
     
  30. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    and the fix for this bug, change line 99 in WheelOptions.cs like below:

    Code (CSharp):
    1. if (mTireModel == null || !mTireModel.isActiveAndEnabled)
     
  31. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    interestingly this also fails in some cases.
    according to unity isActiveAndEnabled = gameObject.activeSelf AND Behavior.enabled but even if both are true isActiveAndEnabled value can be false. may be it is a bug, nevertheless the below line works ok:

    Code (CSharp):
    1. if (mTireModel == null || !mTireModel.enabled || !mTireModel.gameObject.activeSelf)
     
  32. Doughtinator

    Doughtinator

    Joined:
    Aug 8, 2019
    Posts:
    10
    I’ve just purchased this asset and so far it’s great. It does exactly what I hoped it would when using it in an empty project.

    I am getting an error when I import it into a project which already has the UNITY STANDARD ASSET pack. I get the error message below.

    Assets\Standard Assets\CrossPlatformInput\Scripts\CrossPlatformInputManager.cs(24,19): error CS0029: Cannot implicitly convert type 'MobileInput' to 'UnityStandardAssets.CrossPlatformInput.VirtualInput'

    Is there a miss-match or incompatibility with the standard asset? Is there a solution for this that could be easily implemented?

    Thanks in advance.
     
  33. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    hi, thanks for the purchase.

    the problem is just a class name conflict. there is a class named "MobileInput" in Standard Assets\CrossPlatformInput\Scripts\PlatformSpecific and fgear also contains a MobileInput.cs. this class is not part of the core module so you can just rename the file and the class to something like "fgMobileInput", that will fix the errror.
     
  34. Doughtinator

    Doughtinator

    Joined:
    Aug 8, 2019
    Posts:
    10
    Excellent, Thanks for quick response, I thought it would be something like this but hadn't started looking into exactly where it could be. thanks for providing information for the fix.

    Thanks
     
  35. Doughtinator

    Doughtinator

    Joined:
    Aug 8, 2019
    Posts:
    10
    I have a question about the suspension component of the vehicle setup.

    Here is now I understand it...

    The wheels are setup in the scene/prefab in the 'full bump' position?
    The Suspension Length is the length of the spring (full extension?)
    The Suspension Spring is the spring rate used to support the weight of the vehicle?
    The Suspension Damping is the damping effect on the spring.

    Assuming I've understood all this correctly. I have a few questions.

    I set the position of the wheels in my scene, yet on some hard impacts they actually travel up further than how I've set them. is it possible to put a hard-limit on the suspension up-travel?

    Is it possible to change the pre-load on the spring to allow a soft spring to be used but still allow the weight of the car to be supported?

    Ideally, I'd like to be able to specify the following parameter to set my suspension to be as versatile as possible

    - Max Bump-Up - furthest the wheel can move upwards relative to the chassis. this will stop the wheel popping through the wheel arches on lower vehicles.
    - Max Down-Travel (Droop) - further the wheel can move downwards relative to the chassis
    - Spring Rate - as expected
    - Damping Rate - as expected
    - Spring Pre-Load - used to pre-compress the spring rate to achieve the desired ride-height for the given spring rate

    Perhaps I am miss-understanding how its programmed, I'm just trying to translate real-world setup into this virtual.

    Many Thanks
     
  36. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    hi,

    you understood it correctly, the suspension system is pretty basic right now.

    about moving up further than the limit : i tried to make a hard contact solution(physical) but sometimes it results aggressive bouncy behavior so i ended up letting the wheel go up freely. if the vehicles collider touches the ground before that you are ok but it is not always possible so may be limiting visual movement might be a solution, i will consider this option.

    about the preload option : this is on my todo list.

    separating the suspension length into Max Bump-Up & Max Down-Travel : i am not sure this will have any benefit instead of a single value. if you think this will have advantages i would like to hear.
     
  37. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    you can try replacing line 311 in Wheel.cs with the line below, this prevents the unwanted "up travel" but this time tires will penetrate the ground, it usually happens for a very short time so it might be more acceptable then the current state.

    Code (CSharp):
    1. Vector3 wheelPos = mHubTransform.position - Mathf.Max(0f, mCompressedLength) * mHubTransform.up;
     
  38. Doughtinator

    Doughtinator

    Joined:
    Aug 8, 2019
    Posts:
    10
    Thanks for the suggestion, I'll give that a try. as you say, its only on rare occasions.

    regarding separating length into Bump-Up and Down-Travel. I think a potential benefit could be if you wanted to adjust the Bump-up, you would be making that change independently of the Down-Travel.
    Currently you would need to change the Bump-Up in the scene and then compensate by a numerical value so that down travel would would remain the same.

    As a car-guy not a code-guy. having realistic practical ways to setup the vehicle would be more desirable. I think a lot of your target audience for your asset is people (like me) who aren't strong coders, have in mind the way they would like to setup their car. having these 'setup' options which are more representative to a real vehicle would be appreciated.

    for me, now I understand how it works I can make it work the way I want it. but it took me a little while to figure out I was setting up the car at Bump-Up in the scene and then settings were derived from there.

    Pre-Load - excellent, this will be a nice feature

    for moving past the limit, another potential is that a coded 'soft' bump-stop could be possible? so instead of a hard-stop. it hits its limit and then a hard and heavily damped Bump-Stop is used instead of a hard-stop.
    Most cars have these hard rubber bump-stops at the top of their travel.

    I've been using your asset for 2 days and I'm really happy with it. its working great for my semi-realistic simplified racing game.
     
    Lesnikus5 likes this.
  39. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    glad you are liking it.

    ok, i will read about suspension tuning and consider separating up/down travel parameters.

    it might be a good idea but i do not think i will have a meaningful effect, it happens rarely and for a very little time. anyway i will do some experimentation.
     
    Lesnikus5 and Doughtinator like this.
  40. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    hi, i have redesigned the suspension interface and separated those into its own category. i would like to hear your ideas about it.

    preload was in terms of meters at first but i decided to convert it to percentage.
    i used the terms "sag" and "droop" for up and down travel, do you think they are appropriate terms?
    i also have updated telemetry to show "RideHeight" instead of suspension compress percentage.


    ss.jpg
     
    Lesnikus5 likes this.
  41. Doughtinator

    Doughtinator

    Joined:
    Aug 8, 2019
    Posts:
    10
    This looks great. Exactly how I would like to see it.

    So you set the wheels where you’d like them to be in the scene and these numbers are relative to these?

    For sag and droop. I think it probably makes most sense to keep them descriptive like
    Up-travel and Down-travel

    Droop might be an RC car specific term. I’m more familiar with RC than full size cars.

    Sag I think is more a term I’ve heard in mountain biking and is actually most equivalent to ride height.

    As a side note. A gizmo/telemetry which represents a delta number to how the wheels were set in the scene would be a great way for the user to see how closely to their desired ride high their vehicle is operating. Would be a great way for the user to tune their preload.

    Overall. This is all looking great!

    Thanks
     
    Lesnikus5 likes this.
  42. tasadar

    tasadar

    Joined:
    Nov 23, 2010
    Posts:
    240
    thank you, you are right, up/down travel are more descriptive, i will change them.

    yes, these numbers are relative but if you do not set the correct spring rate, you can not get the correct ride height. it is up to the user to tune and find the correct numbers for spring rate. the RideHeight in telemetry shows how far you are from being fully compressed, when fully compressed RideHeight is zero and when wheels are not touching the ground(fully extended) RideHeight is total suspension length.
     
    Doughtinator likes this.