Search Unity

Assets NWH Vehicle Physics

Discussion in 'Works In Progress - Archive' started by NWHCoding, Nov 30, 2017.

?

Which networking solution do you want to see implemented?

Poll closed Jan 20, 2019.
  1. UNet - Unity Networking, getting deprecated sometime in the future

    1 vote(s)
    4.8%
  2. Mirror - Community replacement for UNet (https://github.com/vis2k/Mirror)

    6 vote(s)
    28.6%
  3. Photon

    12 vote(s)
    57.1%
  4. None - I will be implementing my own solution

    2 vote(s)
    9.5%
  1. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hmmm, from all the feedback I would say that the 'drift mode' or at least drift guide is needed ASAP.
    I used my Logitech wheel to do the drifts and was pretty satisfied with the realism but I do realize that the realism is not the key word here (at least not if we are using that video above as a reference). I will add a drift vehicle to the scene, setup for the arcade-y drift behavior in the future updates (added to TODO) since it seems to be a wanted feature.

    What you can do at the moment to make vehicle drift (more) easily:
    - Reduce lateral force coefficient on the rear wheels to be lower than front by 0.2 - 0.3
    - Move center of mass forward. The more you move it the more grip there will be on the front tires and less on the rear tires.
    - Use stabilization from driving assists to reduce spinouts and add more control to the vehicle even when slipping, if you want behavior similar to above you will need to set it to a high value.
    - Possibly increase rigidbody's angular drag or even better:
    - Limit vehicle's angular velocity: https://docs.unity3d.com/ScriptReference/Rigidbody-maxAngularVelocity.html

    Last two have not been tested but that video above looks like it has both to some extent. Now just note that the car in the video is behaving extremely unrealistic and this package is geared more towards realism than arcade.
     
  2. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    New 'telemetry' display coming for the demo scene. It will allow much more detailed insight into some of the basic values and might even be useful for debugging and as a quick overview of the settings. I would not recommend using it in production as it uses reflection, but the plus side is that all the fields that are marked with 'ShowInTelemetry' attribute will automatically appear. Here is the result:

    upload_2018-3-12_11-5-18.png
     
    FargleBargle likes this.
  3. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    Hi

    Any plans on special drift assists?

    Most interested in 2 types of drifts

    Controlled power slides like carx


    Controlled curvy drifts stable
     
  4. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    As I mentioned in the earlier post, it has been added to the TODO and will be implemented. You can check the TODO list with all the already implemented features for next version and fixed bugs.
    Drift assist will be added as a driving aid, besides the ABS, TCS and stability assist. I have not yet decided on the exact implementation but have a few ideas that will need to be tested. My guess that even without drift assist the behavior above can be achieved with some custom friction curves, but that is not always practical.
    Metrics for drift have already been added two days ago and contain: continous drift time, continous drift distance, total drift time and total drift distance. Those can be used to calculate points, combos, etc. in the final game and will also used for NOS charge when that option is added.
     
    MoribitoMT likes this.
  5. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    Oh glad to know.

    I ask it specifically because i bought all car physics assets in asset store and never achieved controlled drifts like in 2 videos even if I modify their source codes. I mean achive many cool drifts, however always controls lost in some points, nothing like first video ( it was a unity asset ages ago called carx technology)

    It has such an importance to me, because your asset in my purchase list, and I will be buying only for controlled drifts.

    Regards
     
  6. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Updated builds with improved setting and telemetry sections are now available for download.
    This is what new setting section looks like:

    upload_2018-3-12_21-34-20.png

    Also, @MoribitoMT I have just started working at drift assist so expect it soon.
     
    FargleBargle and MoribitoMT like this.
  7. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    Where can I download it?

    Thanks
     
  8. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    First post in this thread under "Try it out" or on the asset store page. Builds are versioned through Google Drive so the link is always the same.
     
  9. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    I uploaded the beta with the red car being set up with drift assist so if you find some time to try it out feedback would be very welcome. I tried a few methods and this is what I liked the best - yes, it needs polish and there are some quite obvious bugs but that will be fixed before release.

    Download BETA (Win64 only)
     
    MoribitoMT likes this.
  10. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    Hi, I am Mac user, I can detaily test on macOs if you relase one, on the weekend.

    Regards.
     
  11. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Will do that then on friday after I tweak it some more.
     
    MoribitoMT likes this.
  12. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    Cool,

    I am using Edy Vehicle Physics for long time, pretty satisfied, but controlled drifts were almost impossible with it.

    I copy-catting real Gymkhana Ford Fiesta car settings / features, it helped me great for my drifts. Maybe it can give you ideas. However controlled drift still requires more than physics, like some little hacks into physics.
     
    FargleBargle likes this.
  13. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    I changed a few things and reuploaded beta for Windows and added beta build for MacOS, both of which can be found at the end of the first post in this thread.
     
  14. furkan4156

    furkan4156

    Joined:
    Mar 7, 2015
    Posts:
    7
    not working logitech driving force ? how to add steering wheel axis ? and pedals
     
  15. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hello,
    default inputs in the imput manager are set up for keyboard. You will need to go to your project preferences, input manager section and map the imputs there to your input device. It has been tested and working with Logitech Driving Force PRO and one customer has used it with G27. Force feedback is not supported tho.
     
  16. furkan4156

    furkan4156

    Joined:
    Mar 7, 2015
    Posts:
    7
    Please Little tutorial :/ (car not stop maybe axis problem ? )
     
  17. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Steering and throttle should work out of the box. The only mapping you would normally need to do is for things such as enter/exit vehicle, gear shifts, etc.

    My guess if the vehicle is constantly accelerating is that you need to tick the Combined mode in the wheel settings for it to work with Unity properly. This is not the case with the newer wheels. Here is a little pictorial:

    LogitechWheel.png

    After ticking the option it will function normally.
     
    Barritico and FargleBargle like this.
  18. furkan4156

    furkan4156

    Joined:
    Mar 7, 2015
    Posts:
    7
    thank you so much
    I loved asset
     
  19. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    Hi, I tested the new beta. It looks promising, still not quite like in the videos however I will purchase it next month and work on frictions maybe. Thank you.

     
  20. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    Umm, isn't that also what the driver in your video is doing? Drifting depends on physics, for sure, but it's also very dependent on driver skill. Even if put in the same car, with the same setup and laws of physics to rely on, you or I would be unable to duplicate most of what the driver in the video does - which also benefits from editing out most of the parts where he got it wrong. Any attempts to make drifting "easier" to do in games for people other than Ken Block will of course need to circumvent physics to some extent. :rolleyes:
     
    MoribitoMT likes this.
  21. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    @NWHCoding: I finally got around to trying the demo build you posted on Friday, and it feels better overall. Either that or I'm learning to drive better. In any case, it seems a bit easier to keep the car on the track at high speeds - except when I have the telemetry blocking the view. :mad: Will the release version have the option to pick only the stats you actually want to track, and maybe put them in a banner at the top, instead of having a full screen overlay?

    I realize you can simply hide the telemetry and review it later, but I needed it onscreen while I was driving in this case to illustrate a few questionable numbers it was reporting:

    NVP Telemetry.jpg

    What units are the odometer, top speed, and average speed using? Besides the obvious disparity between my indicated speed and the top speed shown, after half a lap, the odometer is indicating 801.8, while my average speed is 0.6. The RPM value on the gauge is also way different from what's shown in the telemetry. I hope these are examples of what you meant by "obvious bugs", and will be fixed. o_O
     
    Last edited: Mar 21, 2018
  22. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Units are all standard SI units meaning that the top speed, odometer and all other values are in m/s (assuming 1 Unity unity = 1m). Average speed has a bug and is not correct (obviously) while the odometer reads 801.8 meters (0.8 km).
    Values in the telemetry are the actual values lifted directly from the objects by reflection so those are correct values. The RPM on GUI is the one that is off, probably either due to the smoothing or me placing the wrong value range on the gauge controller. Thank you for the bug report :)
     
    FargleBargle likes this.
  23. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    Cool. As long as I know how it works, I can make my own banner for the top of the screen, and lift the raw data to populate it from your telemetry. I can add a conversion to miles or kilometers per hour at the same time. Thanks. :)
     
  24. eonyanov

    eonyanov

    Joined:
    Oct 6, 2014
    Posts:
    21
    Hello! I want to buy your asset but I'm not sure whether I will be able to implement the behavior of the machine as in the game Reckless Racing 3. I want arcade style with fast acceleration. Can you watch some videos about this game ant tell me could it be done?
     
  25. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    Does this works with 2 wheelers like bikes
     
  26. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    The Division, does. but they may be faking it as well, with the tires, Far Cry 5 also has it, but they are mainly deflating tires when shot as the Division which is done with Soft body, but they may be faking it as well. not 100% sure. Both are on XB1.
     
  27. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    would like to know as well. Thanks
     
  28. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    I have checked the video and I can say that yes, it is. If you need any help with setup send me a mail.

    It does not work and I can not promise that it will support it.

    Check the response above.

    Unity forums seem to be acting up again and not sending me notifications and that is the reason I did not reply for so long - good thing I got suspicious as this already happened once. I do check my mail every few hours so it is usually faster asking that way. Sorry for that and hope it will not happen again.
     
    recon0303 likes this.
  29. Justin_Wingfall

    Justin_Wingfall

    Joined:
    May 15, 2014
    Posts:
    125
    compatible or can be integrated with Racing Game Template???
     
  30. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    It has not been tested with Racing Game Template but I have just sent a message to the author and will see if he would be willing to integrate the support for it, or if not I will try to do it from my side.
     
  31. Justin_Wingfall

    Justin_Wingfall

    Joined:
    May 15, 2014
    Posts:
    125
    THX, I was trying to see if I should pick this controller up, but the author said it's only been integrated with EVP so far. I'm definitely going to hold out a tad bit more longer, and see what happens with NWH and RGT. thanks for replay. This controller looks to promising not to have a integration with racing game template.
     
    Last edited: Apr 11, 2018
  32. SilverSho0t

    SilverSho0t

    Joined:
    May 10, 2013
    Posts:
    15
    Hi,
    I was wondering if you're going to improve the damage system before buying this asset, like breakable windows, possibility to lose a wheel when heavily damaged and correct flying object like car headlight when damaged by making them breakable too?
     
    Last edited: Apr 13, 2018
  33. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    There are no plans for damage system overhaul at the moment.
     
  34. Justin_Wingfall

    Justin_Wingfall

    Joined:
    May 15, 2014
    Posts:
    125
    RGT developer said he haven't heard for ya :(. But still going to hold out just a tad bit longer, to see what the verdict is going to be from either side, because if I got to go with EVP, it will be is what it is. Can't wait too long. You know how it goes. :)
     
  35. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    Hi:

    I have two important problems. Other small things I have been able to solve for the code.

    1- It does not detect the texture that the car is treading. I have reviewed the code "step by step" but there is no way. Always detect as "index = 0"

    2- There is a very high cost of FPS. With other physics, the scene runs at 55-80 FPS but with NWH it drops 15-25. With the same camera configuration in both cases.

    For the rest, a very great job. Thank you very much.
     
  36. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Hi, I just want input just of some cents.

    I hope the asst will not be over-dozed with any telemetry hype and multiple real-time values that decrease the performance from one to another update.

    An EA study of the NFS titles revealed that only 1 out of 1000 steering wheels are used and 999 are not usually used. Steering wheels are used for about 4 weeks and then not reused because of their unwieldiness in front of the PC system. Does this sound familiar to you? The most important thing is the keyboard handling.

    You know Eddie's vehicle physics? He put a lot of time and effort into the handling for Steering Wheel but ignored the keyboard handling. For me the asset of Eddie is not usable.

    One of the best tracks to drive on android is RR3 to me. The entire physics of the car and the contact with the ground is based on a single point in the middle of the vehicle and not at 4 points of the tire as you might think. On PC it's NFS 2016, Payback with single points on each wheels.

    Further you get the best multiplayer competition results with keyboard or pad.
    Please keep this in mind, thank you.
     
  37. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    1 - I guess we are talking about the thread texture? Or the ground index (as in different surface friction presets)?

    2 - Are we talking about the demo scene? If so then it is quite intensive for both CPU and GPU since there are a lot of relatively high tri models in the scene at the same time, along with grass, trees, high resolution terrain, soft particles, post processing, etc. The physics itself should not cause any problems with performance (<1ms of CPU time for me using a Windows build for vehicle physics related calculations).

    If you do find bugs or need support fastest way is to contact me by mail most of the time.
    I am collecting a list of bugs as usual (TODO link on the first post) and do updates as soon as I collect a few smaller bugs or a larger one or two - same for suggestions.
     
    Last edited: Apr 15, 2018
  38. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    I lost to ask, is there a chance to reduce the brake ratio in the demo.The cars stop in ~3s from 180km/h to 0. I tried, but only the handbrake ratio change.
     
  39. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Telemetry in here is just a demo-specific reflection based script that I made to show people some of the more interesting values that are available. It is not intended for production use.

    Yes, I did a lot of research before getting into developing WC3D. Decision was made to use per-wheel physics to be able to use rigidbodies which I always prefer since they are native and work nicely with each other, and the other very important point is that single point physics usually do not work very well in scenarios they were not specifically work for (car physics will not work on 8-wheeler for example).

    I actually got the wheel just to test the asset with it and it is mostly collecting dust at the moment since 95% of the testing of the asset is done on keyboard + mouse combo.
     
  40. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    You could reduce the brakeCoefficient (just above the handbrake one). There is a class that holds the brake related values where the actual brake torque can be adjusted but I excluded it from auto-generated options since it did not strike me as the most interesting one and I was a bit tight on screen space.
     
  41. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Mail has just been sent, will update you soon.
     
  42. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374

    Hi.

    Following the manual, I set up the GROUND DETECTION script with 4 ground entities. The origin is the default script of the NWH of the ISLAND scene.

    The first is ASPHALT. I have removed the texture and I have set TAG = ROAD since I use the EasyRoad 3D road asset v3.0

    The second one is GRAVEL. I have incorporated my 2 textures that correspond to that ground.

    The third is SAND. With 2 textures.

    The fourth is GRASS. With 9 textures.

    All the remaining data and parameters are the same as in your default script (the one I mentioned above)

    Attached screens.

    Thanks

    groundDetection.png
     
  43. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    I am on mobile at the moment and will review this in more detail tomorrow, but make sure you start counting textures from 0 (first one is 0 not 1) and I would suggest checking if the friction preset gets changed on the Wheel Controller inspecorr or on the telemetry screen if you still are inside the demo scene.
    I will check first thing in the morning that it is not a bug.
     
  44. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    Ok. No problem.

    Effectively, I assign the textures counting from 0 for the first and so on from left to right and top to bottom.

    It is true that I do not assign the 0 at any time as it is the image of Google that serves as a guide. It is not stepped on at any time.

    Maybe I should assign it even if it is not used?

    Thank you!!!
     
  45. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    I have set up the demo scene to mirror your settings and (as expected) it still worked.
    Some things that might be the problem:
    - Do you by any chance have two terrains in the scene? Asset always queries Terrian.activeTerrain to get the index so multiple terrains might cause something like this.
    - Did you check if the friction preset is changed on WC3D objects?
    - Check that that SkidConainer is generated in the hierarchy (at scene root) with multiple objects inside it.
     
  46. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    - No. Only 1 terrain in the scene.
    - All OK.
    - I do not understand what this means.

    In GetTerrainTextureComposition (code revision line by line)

    - terrain is OK. All variables are correct.
    - terrainData is OK. All variables are the terrain variables.
    - terrainPos is 0,0,0 allways.
    - worldPos has the correct data of the location of the wheels (example 1413.0, 343.3, 1830.6)
    - mapX and mapZ contains different values according to the formulas applied.
    - splatmapData has ALLWAYS value (1,1,0)

    CellMix allways has value 0


    More data.

    I use CTS and Real World Terrain.

    Thanks
     
  47. TiToMoskito

    TiToMoskito

    Joined:
    Jan 28, 2014
    Posts:
    66
    Did you recognized the amount of the GC? For me it's about 120kb, clean project with your asset only. This happens only in FixedUpdate, but i had no time to check.
     
  48. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Demo scene uses about 0.5KB of GC per one fixed update, and that is from WC3D which is being called for the demo scene over 50 times per one fixed update as there are many wheels in the scene. That should not cause any problems and is the result of Enum.Parse() function in FrictionUpdate() function of Wheel Controller.

    upload_2018-4-17_12-11-19.png

    The rest of GC is from particles systems and other visual effects, but for me the demo scene totals at about 50KB of which 41KB is graphics related.
     
  49. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hmm, my guess from this data is that the CTS might be the culprit if it overrides the textures in some way.
    Everything related to ground texture detection is inside GroundDetection.cs at lines 184 and onwards and relies on using GetAlphamaps function (https://docs.unity3d.com/ScriptReference/TerrainData.GetAlphamaps.html) and finds the most dominant texture from the returned data. It could be that CTS uses it's own (most likely) texture mapping which would in turn render this function to always return a single value.

    Ideally it would be best and fastest if you could send the project over to my mail but I do understand that this is not always possible due to the licences and similar. Your descriptions have lead me to believe that it has something to do with CTS because this is the first report so far of ground detection not detecting the surface type since the asset was released - and I am quite sure someone would notice something as important as that. Could I ask one more thing - could you try it with a default terrain without any addons?
     
  50. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    374
    I made some changes to the code and now it works perfectly.
    Thanks!!!