Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NWH Vehicle Physics 2

Discussion in 'Assets and Asset Store' started by NWHCoding, Apr 8, 2020.

?

What would you like to see implemented next?

Poll closed Feb 12, 2023.
  1. FMOD sound module

    0 vote(s)
    0.0%
  2. Tracked vehicles

    3 vote(s)
    30.0%
  3. Softbody wheels

    7 vote(s)
    70.0%
  4. Something else (mention in the thread)

    0 vote(s)
    0.0%
  1. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    I have been repeatedly unhappy with how the motorcycles worked and this ended up moving the release date further and further away. The newest idea is to do my best and release them as a part of the package as a beta.
     
  2. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    yes please
     
  3. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    A new video is up, this time driving around in 4K.

     
    Willbkool_FPCS likes this.
  4. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    Have the demos been updated, still waiting for the demo to be able to do drifting and doughnuts, still doesn't seem possible in the demos.
     
  5. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    Racetrack demo is the most up to date. I also uploaded a new video (above) with me doing doughnuts for about half a minute. Drifting works as expected but is tricky on keyboard/mouse. Have spent hours comparing to rFactor2 / PC2 / DR2 and tweaking the setups and physics.
    Just note that it is still more physics/realism than arcade oriented.
     
  6. loliconest

    loliconest

    Joined:
    Sep 21, 2015
    Posts:
    31
    Hi,

    Looks like a robust vehicle physics engine. However there are many similar assets currently available, so it's a bit hard for me to choose one.

    I know this is a realistic-focused physics engine, but for my project I want something like Trackmania, arcady but not cartoony (if you know what I mean), and also deterministic. Can your engine do that?

    It would be even better if customer support can help users achieve what they want :D

    Many thanks!
     
  7. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    Trackmania is heavily arcade. NVP2 leans towards rFactor2/PC2/Dirt2 and other sim games and these are actually the games I use to tweak the demo vehicles. Also, NVP2 is quite suitable for heavy machinery, off-road, etc. since it actually simulates differentials, transmissions, etc. in a relatively physically accurate sense. Not to mention completely custom wheel solution.

    I would suggest checking the demos and seeing for yourselves if you like the behavior of the vehicles or if it is too sim-oriented for you.
     
  8. loliconest

    loliconest

    Joined:
    Sep 21, 2015
    Posts:
    31
    Thank you for your timely and honest response! I do wanna get a sim-focused vehicle asset just in case I'll need in the future, so I may still buy it during sale :D

    It's probably not proper to ask but I still wanna give it a shot, is there any other vehicle assets that you know that might be better suited for my need?

    Thank you very much!
     
  9. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    Not really as I do not go around and test every asset. Not saying that NVP2 would not do it, just expect some realism and not NFS Most Wanted style of driving where you can do 300 km/h and a controlled drift over curbs by just holding the right key, all while not spinning out or any of that "reality" stuff :D.
     
  10. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    Odd answer :) Surely drifting and doughnuts are 'real'? I would say the more accurate the physics the easier it should be to do drifting and doughnuts. I have checked many physics engines and sims and the ones that can handle such things are few and far between. Checked out your cool video, which does look very nice I have to say, but it still seems its a struggle to get the car to basically turn around its front tires when spinning the rear wheels, it does it for a revolution or so then stops. Fine for basic driving and racing but not ideal for drifting and gymkhana stuff which needs really top end tire simulation.
     
  11. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    rFactor2, Project Cars 2 and Assetto Corsa are usually considered the most realistic driving sims out there. Try doing doughnuts or power slides / drifts in there. There is a reason why drifting IRL is something that requires a very experienced driver and even pros (check WRC) rarely do clean drifts. I am not saying that my asset has top of the line tire physics, but the fact is that a lot of games that are know for drifting do not even go in the way of simulating tires in any realistic manner.

    The games that you are mentioning do the driving for you through AI or similar assists. These are games like Forza Horizon that allow you to feel like a pro while driving on the keyboard. In fact, in these games you are telling the vehicle in roughly which direction you should go and the AI does the steering for you. I once did a project for a company which had a whole department dedicated to driving assists.

    My point is - get into any of the games listed at the top of the post, turn off assists and do a doughnut or a drift. Good luck :). That said I would like to implement similar 'smart' assists into the assets but this is something that is very hard to get right.
     
  12. Zubair_Malik907

    Zubair_Malik907

    Joined:
    Jun 19, 2019
    Posts:
    15
    I'm trying to set up American Truck via NWH Vehicle Physics.
    Issue is: Once my semi truck start bouncing due to uneven path, it never stop bouncing.
    I'm attaching my model picture as well.
    I'm working from weeks on it but no settings going to help me.
    Help required ASAP.

    upload_2022-4-12_15-10-7.png
     
  13. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    Hello, check the response I gave to your email.
     
  14. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
  15. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    Lighting deal (80% off) start is in 25 minutes.

    2022-as-springsale-smartphonelg.jpg
     
  16. Zubair_Malik907

    Zubair_Malik907

    Joined:
    Jun 19, 2019
    Posts:
    15
    I've not received any response to my email.
    Kindly response at
    zubair.malik907@gmail.com
     
  17. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    My bad, I responded to the Unity's email about your message instead to you. Late night work does things like that.

    Here is the message:

    Hello,
    that sounds like either the truck does not have any or adequate damping and/or Time.fixedDeltaTime is extremely high. Default of 0.02 is fine, but going over 0.05
    might cause issues. So I would check the damping first and maybe cross-reference the suspension values with the included demo semi.

    Regards,
    Aron
     
    Zubair_Malik907 likes this.
  18. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    Last edited: Apr 13, 2022
    ledshok and Willbkool_FPCS like this.
  19. Zubair_Malik907

    Zubair_Malik907

    Joined:
    Jun 19, 2019
    Posts:
    15
    Time.deltaTime is set to 0.02 so there must be damping issue ?
    Do I have to share my truck model with you to pinch out the issue ?
     
  20. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    Have you tried copying the spring/damper values over from the semi in the demo? There cars are there as a reference, apart from being demo vehicles.
     
  21. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    NWH Vehicle Physics 2 will be on sale for 10 more days.
     
  22. eddyjohnson3

    eddyjohnson3

    Joined:
    Jul 27, 2012
    Posts:
    49
    Hi, I'm having a little issue with the transmission on a semi truck vehicle, this actually happens on the demo example semi truck as well. So the truck has a large number of gears as it should, but when set to automatic transmission and truck accelerating, it will shift up 2 gears at once, and this will often result in transmission quickly shifting 2 gears back down again resulting in a silly 2 gear up and down shifting sequence. I tried to play around with the variable shift point numbers but that did not help much...
     
  23. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    The gear hunting definitely should not be happening and it is caused by gears being set to close apart which results in vehicle slowing down enough during the shift up to actually end up in too low gear for the current speed.
    Ways to get around this is either using longer post-shift ban times on the transmission, higher shift up and lower shift down gears and possibly sequential automatic if gear skipping is not desirable. I will see what I can do to make to improve this but even earlier real-world automatics had issues with this.
     
  24. kopanz

    kopanz

    Joined:
    Dec 6, 2016
    Posts:
    82
    By using Vehicle setup wizard with semi truck and trailer templates, I'm able to drive a semi truck with the trailer. But only if i reverse to the trailer and attach to it. If i align the truck the the attachment point perfectly and press T on start, the truck gets stuck like the trailer is braking. If I use Attach on Play option, im getting a NullReferenceException in AttachTrailer function of the TrailerHitchModule.cs

    VehicleController trailerVc = _trailer.VehicleController;

    trailerVc is null reference and causing the issue.

    These problems doesn't occur in Racetrack demo scene with Renault Semi and trailer.

    How i can fix the issue ? I use setup wizard and default settings. Nothing is changed.
    I use version 1.7.5

    Additionally i have difficulties to switch driving forwards after backing up. This happens in all customly built vehicles.
    Vehicle stops braking before reaching to 0 kmh and continues to slowly move backwards. Handbrake doesn't work in this state. I had to accelerate backwards and brake again to try switching to drive forwards again.
     
  25. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    The issue with switching between D/R might be due to the clutch engagement point. Check that the clutch is not staying engaged when trying to stop. If it is increase either the clutch engagement RPM or decrease engine idle RPM. I will investigate this as there was a similar report recently.

    As for attaching the trailer on awake - my best guess is that the trailer is not tagged correctly and therefore it fails to recognize it. The error however should not happen and also a thing that I have added to Trello for the upcoming update.

    And lastly make sure that Vehicle Controller > Settings > Freeze While Idle is disabled for both truck and trailer (this should be automatically disabled on awake / trailer connection) and that the attachment points are correctly aligned and there is no collider overlap on these two vehicles.
     
    kopanz likes this.
  26. kopanz

    kopanz

    Joined:
    Dec 6, 2016
    Posts:
    82
    Both the truck and trailer use "Vehicle" tag. It's probably set by the vehicle setup wizard. I didn't changed the tag.
    There was no colliders on truck and trailer except the wheel colliders. Now i added them but it also didn't make a difference about the issue.
     
  27. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    I have to reference the docs but I believe that there is a tag field in the Trailer module where you can set the corresponding trailer tag so that multiple types of trailers can exist for different vehicles. I would check the demo setup.
     
  28. kopanz

    kopanz

    Joined:
    Dec 6, 2016
    Posts:
    82
    Here is how the TrailerHitchModule and TrailerModule looks like. There is no field for trailer tag. It's ok to add ConfigurableJoint permanently and not use attach/detach and trailer brakes for a while. But please find a solution in a few weeks.

    trailerHitchModule.JPG trailerModule.JPG
     
  29. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    You are correct. I went to take a look at the code and the tag-based approach was removed some time ago, I just forgot I did it. So that is not the issue.

    However, looking at the code I found what the issue might be. The list of trailers is getting updated for the TrailerHitchModule only on Initialize() (i.e. Start()) which means that additionaly spawned trailers will not get registered.
    I am working on an update right now so will add that to the TODO for it.

    As for the braking issue, it would be very helpful if you could send a repro project over so I can take a look at it.
    Thank you and sorry for the complications.
     
    kopanz likes this.
  30. kopanz

    kopanz

    Joined:
    Dec 6, 2016
    Posts:
    82
    It's replicable in Racetrack demo scene. Unpack SemiTruck prefab.
    Delete every NWH related scripts and wheel colliders on SemiTruck.
    Use Vehicle Setup Wizard to setup vehicle. Use SemiTruck preset.
    Switch to reverse, back up slightly with S key (just enough to roll at 3-4 km/h) ,
    then press W key. It's going to ignore W key or Space key and keep moving backwards slowly.
    I can send you a demo project but it's more related to how i drive.
    But it's really hard to not encounter to this bug when you drive forward/backward very frequently.
    It's even happening when you move Niva car completely from the demo to another scene and try to drive it.
     
    Last edited: Apr 26, 2022
  31. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    Ah, I misunderstood the first message.
    This is a known issue reported yesterday by another customer and the cause is that the clutch never gets disengaged since VehicleSetupWizard sets the clutch enagament RPM to a too low value, meaning that the vehicle gets stuck in gear with clutch enagaged. The fix is to increase the clutch engagement RPM value to something higher, e.g. 1000. The update will be within the next two days.
     
    kopanz likes this.
  32. kopanz

    kopanz

    Joined:
    Dec 6, 2016
    Posts:
    82
    There are still plenty of GC Alloc in NRigidbody.FixedUpdate.
    It's happening on both version 1.7.5 and 1.7.6
    0.7 KB GC Alloc is not insignificant.
    My FPS dropped to 20 in the editor with 4 NWH vehicles.
    Please have a look to the issue before the update.
    I'm using Unity 2020.3.30f1
     
  33. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    Just did a check and the issue is not actually NRigidbody but the GroundDetection (which runs as a callback from NRigidbody) and the Unity function that gets the data from the terrain. Will see what I can do.
    If you switch to deep profiling it should tell you exactly what function call is causing it, so it would be great if you could share that info just to check if it is the same function.
     
  34. kopanz

    kopanz

    Joined:
    Dec 6, 2016
    Posts:
    82
    Yes. It's the GroundDetection. Is there an easy way to disable it ?
    I don't need the detection of different types of grounds in my use case.
    Sorry for continuously reporting problems but I'm not requesting new features :)

    nwhGround.JPG
     
  35. Zubair_Malik907

    Zubair_Malik907

    Joined:
    Jun 19, 2019
    Posts:
    15
    I've tried it also but nothing is working for me.
    I'm working on FYP and deadline is around the corner. help required.
     
  36. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    You could send a repro project over and I will take a look at it. Email or Discord if possible for faster response.
     
  37. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    No problem.
    You can disable it by going to the Settings > States > StateSettings and disabling it there. It will disable it for all the vehicles sharing the StateSettings. http://nwhvehiclephysics.com/doku.php/NWH/VehiclePhysics2/StateSettings
     
  38. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    NWH Vehicle Physics 2 is entering the last day of the Unity's Spring Sale (ends April 29, 2022 23:59:59 PT).
     
  39. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    Update v1.7.7 is on the way and should be live within one hour.

    v1.7.7

    29/04/2022
    • Overall clutch improvements: added clutch engagement curve, reworked clutch torque flow, fixed engine not stalling when clutch dumped.
    • Improved engine power calculation to allow for holding the engine at steady RPM in neutral.
    • Added SteeringWheelInputProvider zeroToOne option (can be use to select 0→1 or 1→0 as axis reading) and option to flip input for handbrake.
    • Added clutch engagement RPM warning when clutch RPM < idle RPM.
    • Added SteeringWheelInputProvider handbrake axis.
    • Fixed low clutch engagement RPM in VehicleSetupWizard.
    • Fixed stop lights canceling tail lights in multiplayer.
    • Fixed high beam lights do not turn on the tail lights.
    • Fixed states not getting serialized after adding a module and refreshing.
    • Use power of 2 textures for skidmarks to reduce memory usage.
     
    kopanz likes this.
  40. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    An ArcadeModule is on the way. Not very complex at the moment but it does help with getting the vehicles behave more arcade and makes them easier to control with keyboard, especially at higher speeds.

    Artificial Steer
    - adds steer torque to the Rigidbody itself, bypassing friction. It helps vehicle keep the direction in which the input is pointing. It also stabilizies RWD cars when accelerating to prevent the rear end from swinging out.

    Drift Assist
    - keeps the vehicle from spinning out when drifting by allowing it to drift up to a certain angle, above which a corrective force is applied. Results in vehicle drifting through the corner instead of spinning out, without corrective input that would normally be required.

    Other features will be added as required in the future.

     
    kopanz and ledshok like this.
  41. kopanz

    kopanz

    Joined:
    Dec 6, 2016
    Posts:
    82
    Hi,
    Could you have fixed the issue about attaching trailers ?
     
  42. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    There were some changes but one issue with attaching trailers on awake seems to persist.
    Working on v1.7.8 right now so will patch it in the next few days if I manage to reproduce.
     
    kopanz likes this.
  43. Zubair_Malik907

    Zubair_Malik907

    Joined:
    Jun 19, 2019
    Posts:
    15
    Here is drive link "" to vehicles, I'm using in project. please download, apply settings the way you want & share back with me.
    Thanks in advance.
     
    Last edited: May 12, 2022
  44. bvonline

    bvonline

    Joined:
    Feb 27, 2021
    Posts:
    84
    I am waiting especially for this... when can I expect that update? Just for me to know a time range.

    I want to create something like it is seen in "Arcade Vehicle Physics". As I just bought the asset - did not use it yet - I assume that I will be able to create also that kind of tilting the car to the side wth your asset, am I right? For a more "cartoony" behavior...

    Thank you for your answer in advance!
     
  45. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    The estimated release time is <1 week. If you want I can send you the script via PM.
     
    Last edited: May 9, 2022
  46. bvonline

    bvonline

    Joined:
    Feb 27, 2021
    Posts:
    84
    Cool. That's enough time. I will wait for the update then. Thank you very much...!

    Asking again - is it possible to create a "cartoony" car driving behavior as mentioned (if you read my question before)?
     
  47. Zubair_Malik907

    Zubair_Malik907

    Joined:
    Jun 19, 2019
    Posts:
    15
  48. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    Hello,
    I have checked the files and you have sent me the raw .fbx models, not the set up vehicle that has the issue.
    Also, please do not post drive links in public threads if all the models/assets are not owned by you and/or have a commercial license. Send me a personal message instead.
    It would be best if you made an empty project with the problematic vehicle in it, as it is set up right now, and I will take a look at it and see what is configured wrong. You can also remove the Library folder from the package to save on space.
     
  49. Zubair_Malik907

    Zubair_Malik907

    Joined:
    Jun 19, 2019
    Posts:
    15
    My bad, I'll it in PM now.
     
  50. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,684
    A few more changes have been made to NVP2 for the upcoming update. The substep selector is now a dropdown with values in [Hz] and the substep count is calculated automatically from the selected value and the current Time.fixedDeltaTime:




    This clears up the confusion around substeps and increases performance as it takes the base update rate into account. So if lower Time.fixedDeltaTime is selected (meaning higher global physics update rate) the NRigidbody substep count is reduced.