Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Assets NWH Vehicle Physics

Discussion in 'Works In Progress' 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. Freznosis

    Freznosis

    Joined:
    Jul 16, 2014
    Posts:
    293
    Here's my small review of the final demo.

    Here is an album of some of the problems I noticed/encountered.

    1. If you manage to land a vehicle on the front of it's nose it will infinitely spin in circles because the flip over action is trying to flip the car over on the wrong axis.

    2. If you hold the throttle button when entering the car, the car will jump forward, then stop for the startup sequence, then go on as normal. I guess this is happening because input isn't being restricted on the first couple of frames that the car is re-enabled when entering.

    3. If you drive the car slow enough, you can exit and it will keep moving. I was able to reliably reproduce this on inclines. Can't get it to happen on flat ground. Also if the exhaust flames are active, they won't be disabled when exiting.

    4. I don't know if this is necessarily a "problem" or how the physics were made to behave. So I guess you could see this as more of feedback instead of a bug report. I think the vehicles are far too twitchy in their default state. That might be the behaviour some people are looking for. But it kind of gives the vehicle a "cheapness", like if they are toy cars. They will lose traction in an instant with little movements on keyboard and controller. I think it's also a pretty weird behaviour to not be able to "save" a spin. When the vehicle loses traction, you will just keep steering into that direction until you either slow down or hit something to stop the momentum. It feels like you kind of "get stuck" in that oversteer motion and it doesn't matter how you turn the wheels, you can't get out of it. I think this should be looked at or maybe this can be stopped by changing some settings. I'm not sure, but I will wait till the full release to really test everything.

    5. I forgot to capture this on video, but the tailights will flicker a lot when you are nearing a stop. It will also happen a lot more while using manual transmission.

    None of these problems take away from the asset. You've done really good work! Congratulations on this great asset.
     
  2. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    I love feedback so thank you very much. It can be hard to adjust some behaviors so feedback is very helpful.

    1. bug
    2. Noted. It is either clutch engaging while starter is active or similar. Starter is quite strong on its default setting to prevent "why is it not starting?" confusion when setting up vehicles.
    3. Thanks for the spot.
    4. Too low intertia on the Y axis combined with no input smoothing (using raw input). Will adjust. The other issue is most likely due to suspension settings being off.
    5. ABS is rapidly toggling the brakes. I noticed this one too.
     
    GLID3R82 and Freznosis like this.
  3. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    244
    I have played arround with the demo. The feedback I can give is:

    Steering is very sensitive with WASD. Sports car is near impossible to control. Played around with some of the steering settings, didn't seem to help much.
    MMB scroll is for zoom, LMB to pan left, right, up and down. It only works for 1 camera, and that camera doesn't point in same direction of the vehicle once it is moved. Not sure if this is intentional.

    Other than that, I like it, and definitely upgrade if I can get the steering balanced(I assume paid upgrade or do you need to purchase again?)
     
  4. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    I will post an updated demo with improvements to all the points.
    The direction thing for the camera is an option:
    upload_2020-4-3_20-8-9.png

    I will make it so that it follows the target by default in the new demo build.

    It was supposed to be a free upgrade but at this point I am debating this as the upgrade went way beyond the scope of what was intended.
     
    Last edited: Apr 3, 2020
    GLID3R82 and nobluff67 like this.
  5. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    The latest build is up: link
    I have fixed the things you have pointed out and a few more.
     
  6. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    244
    I dont see that camera settings. The steering is still very sensitive, e.g. pressing "a" key jerks car to left, so diffictult navigating corners. Is this maybe my machine? I only ask as the nvp1 is very smooth when run within editor.
     
  7. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    The camera settings are visible only in the editor.

    The steering has smoothing setting and deg/s setting. Both can be adjusted. If it is visually smooth and still 'jerks' then it is these settings that need adjusting. I am using raw input which means there is no input smoothing that Unity usually does.
    Apparently I need to damp it some more.

    EDIT: Build updated, please try now.
     
    Last edited: Apr 3, 2020
  8. Freznosis

    Freznosis

    Joined:
    Jul 16, 2014
    Posts:
    293
    I think it would be a good idea to make it a paid update. And I'm saying this mainly because there has been a lot of effort put into the asset and it seems to be a complete upgrade from NVP1. I'm sure that would make some people angry because a lot of people want to only pay for an asset once and have updates for life, but that is just really unrealistic, especially in the software world. That mindset usually gets bigger assets like this one abandoned because the author doesn't make enough profit to keep developing it. All their sales came from an early version of the asset and now they are making only a couples of sales a month but still expected to provide big updates. It's not such a good trade off. That's why a paid update makes more sense here. You would continue getting money to help along development and be able to continue to provide support.

    And as an additional idea, maybe you can follow the example of other asset authors. They leave the original version of the asset up at its original price (or reduced price) and the new asset is listed alongside it a higher price. You could still provide small bug fixes and what not to the original asset, because I'm sure there are projects that still use NVP1 and can't upgrade to NVP2 just yet but are suffering from some problems that are only fixed in NVP2. It would allow new and existing customers greater flexibility.
     
    Last edited: Apr 4, 2020
  9. Janoooba

    Janoooba

    Joined:
    Feb 9, 2016
    Posts:
    37
    I agree with Freznosis here. Though I think the "Upgrade" pricing some asset developers do would be a good option here, where owners of NVP1 get a discount.
     
    krou, nobluff67 and NWHCoding like this.
  10. geralex

    geralex

    Joined:
    Apr 17, 2014
    Posts:
    7
    Greetings. Why does the interaction of the truck with the collider lead to this reaction?
    Logically, the IsTrigger option turned on disables the collider object.
     

    Attached Files:

  11. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    Go to Project Settings => Physics => Queries Hit Triggers and the behavior will be solved.
    This is because raycasting by default detects triggers.
    If on the other hand you need queries to hit triggers, then put the triggers on a separate layer and add that layer to the ignore list of the WheelController.
     
    geralex likes this.
  12. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,019
    Tried the latest demo but its a bit of a disaster with an Xbox controller, on entering the demo the view just moves making it hard to get to a vehicle, when you do the cars flip over or move out of the way. When you can finally get in the car it drives off backwards and no combination of inputs seem to get it back under control.
     
  13. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    My bad there, I left the axis 4 in the inputs from earlier testing which seems to cause a lot of issues with Unity input. I will reupload with some other improvements, mainly to the friction and vehicle behavior in the next half hour.
     
  14. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
  15. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,019
    Great works now, very nice as well. Can you suggest the settings I need to change to be able to do doughnuts as even with TCS off and changing the diffs just doesn't want to do them.
     
  16. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    I might have overdone the "Maximum Tire Grip Force" a bit. That is the culprit.
     
  17. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    307
    Hi.

    Waiting for this new version with impatience.

    A question. Will you be able to connect with Force Feedback (FFB) steering wheels?

    Thank you.
     
  18. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    Here you go, I was able to find an issue and tweak some things which results in much better handling: link

    FFB is in the plans for the near future as a module. I have actually started to work on FFB for Logitech SDK but have scrapped that and will go with the DirectInput instead.
     
    Last edited: Apr 5, 2020
    mthawley and Barritico like this.
  19. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    307

    Thanks!!!
     
  20. RichardSim

    RichardSim

    Joined:
    Dec 15, 2013
    Posts:
    14
    The latest demo build (from #1018) is looking great! I'm really enjoying both the monster truck and sports car - the sports car especially feels *so* much better than it did in earlier builds, and isn't constantly having weird collisions anymore.

    A few notes:
    1. Gamepad stick input still doesn't seem to be able to control the camera orientation when out of a vehicle (was supposedly fixed in #1013? Was it lost in the build from #1018?). I'm using a dual-stick 8bitdo controller that appears as an X360 controller.
    2. Odd impulses from collisions when in the air, especially for the sports car (I suspect because it gets air much easier). After a jump it probably spent a good 30 seconds going haywire all over the place until it finally came to a rest.
    3. Jumping the monster truck feels weird. With such huge wheels, the inertia as the RPM increases (due to no-load) or decreases (due to breaking) should have a very pronounced impact on the flight; i.e. kicking the front up or down respectively. Obviously this force isn't being accounted for at all, but it'd be very interesting to see the impact on the dynamics if it was (even for regular driving due to weight shift). At this late hour of the release schedule I don't expect such a change to make it in, but for the future it would be worth considering.
    4. UI clicks with the mouse (e.g. Repair button) make stick input control the UI somewhat randomly, such as changing the time of day. I haven't been able to find a way to reliably get the stick control back after this happens, as it inevitably starts happening again at the most inopportune time. :)
     
    NWHCoding likes this.
  21. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    75
    I know it has been already mentioned but i can't fix this balloon effect no matter what i do(car bumps, flies off in air without rotating). I believe it has to do something with wheel controller since car rigidbody isnt affected by vehiclecontroller. Is it possible that some ticks in wheelcontroller arent sync with the physics ticks? I have tried many settings in physics settings and still cant find a proper way to fix this. My game is dependant on tire physics, but also on impact physics. What can i do to avoid this odd behavior?
     
  22. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    I am assuming we are not talking about the demo but rather about NVP1? Could you please send me a short video of that behavior on the email (nwhcoding@gmail.com)? Seems very bizzare, especially since every wheel applies forces to it's own position, meaning that all the wheels would have to apply the same force at the same time for the vehicle to fly directly into the air.
    One scenario that comes to mind would be if you have a vehicle collider (BoxCollider, etc.) that is not on the ignore layers list so that when the suspension compresses the top of the wheel catches that collider, detects is as ground and suddently thinks it is under the ground, after which it tries to compensate and the vehicle flies up.
     
  23. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    Thanks for the feedback. 3 and 4 have been fixed while 1 and 2 will not be fixed for the release.
    I also did some last minute improvements to the 8x8 truck and fixed the issue where the clutch would not disengage between gears. The asset will be submitted in the next few hours.
     
    RichardSim likes this.
  24. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    75
    Actually, this happens both on NVP1 and NVP2. I have uploaded 2 videos showcasing this issue.



    notice the third second in second video. It is not so obvious, but still it happens. The car bumps into ground, resulting in a slight bounce of without rotation being affected. Normally the car would start spinning which is not the case here. Everything after is just car trying to flip itself back which is understandable. I was going high speeds to make this issue more obvious but note this also happens in lower speeds and in rare scenarios. It still happens...
     
  25. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    This is classic Unity collision for you.
    I have experimented some with adding my own forces in OnCollisionEnter but this had some issues, still, I will look deeper into it since I agree that the behavior is a bit weird.
     
  26. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    The final build is available here. No more changes will be made for the release.
     
    Guacamolay likes this.
  27. eclipseanu

    eclipseanu

    Joined:
    Jan 6, 2017
    Posts:
    10


    They all seem to be changing gears too fast, but the big 8 wheeled one is the most affected by it.
     
  28. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    The big one has 16 gears, and I have introduced code that prevents skipping gears if throttle is above 80% to prevent gear hunting on inclines. I will increase the shift times somewhat. While comparing with other games I noticed that the inertia on the engine might be on the low side.
     
  29. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    75
    What do you mean, classic unity collision? Does it mean that box colliders cause this? I can say i have pretty good lod styled collision models for each car special, and this behavior happens just like with box colliders. I never noticed anything like that with any physics solution. UnityCar physics never had this behaviour. This asset was used on game My Summer Car. I can truly say i have played that game long enough to say if that happens or not and i can truly say in every collision, it never actually happened. There has to be something with your asset, not with the collisions. I cannot explain it to myself any better.
     
  30. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    I have just been trying to reproduce the issue since you say that it only happens in my asset and realized that using a Physics material with 0 Dynamic and Static Friction (which was used in the first place to prevent vehicles from sticking on things) is the most likely cause of this. I do not do anything to modify the collisions in the code.
    This could be the reason since in the first video the vehicle looks as if the front end just slipped over the surface, without grabbing onto it - which is what would cause the spin normally.

    EDIT: I have updated the demo with a few fixes, improvements and the Physics material friction change mentioned above.
     
    Last edited: Apr 6, 2020
  31. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    75
    I really feel bad for saying this, but it actually got worse..



    EDIT: Out of 5 tries this happened twice
    EDIT: Could you please add debug switch to disable wheelcontrollers/vehiclecontrollers with binding so i can press at specific time ? I would like to debug what is the cause. Finding out what is the cause depends on timing, i dont see any other way solving this.... Maybe different collision detection modes? Afaik the game i used to play always used discrete detections.
     
  32. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    Here is the Android build.
     
  33. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    Asset has been finally submitted to the asset store after a lot of double checking and polishing. And a lot of coffee.

    The discussion related to NWH Vehicle Physics 2 is moving to this thread to avoid confusion between the two.
     
    GLID3R82, RichardSim and Guacamolay like this.
  34. Guacamolay

    Guacamolay

    Joined:
    Jun 24, 2013
    Posts:
    63
    This type of behaviour looks like it could be due to high drag and angular drag values on the Rigidbody. It sounds weird, but I tend do use a higher gravity value to acheive more "realistic" feeling and less floaty physics in Unity (by realistic I mean how I would perceive how the crash should occur).

    Other tricks to improve the physics - Lower the fixed timestep so you have increased physics loops, use primitive colliders instead of mesh colliders, add a counter force on collision as mentioned previously on this thread (In real life the vehicle would crumple and wouldn't bounce off like a solid block)
     
  35. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    As the asset is now finally submitted I will immediately start looking into things like this. The issues of higher importance have been resolved and polish is what I am expecting to do for the close future, with additional modules and features only coming afterwards.
     
    GLID3R82 and overthere like this.
  36. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    75
    Dont get me wrong, but things you say here are absolutely out of context. I'm not going to do workarounds for a bug that should not be in. I don't want any unexpected behaviour to pop out from your solutions stated above. Something like high angular drag and high velocity drag is absolutely out of context. It always reproduces random results. Sometimes it changes rotation, sometimes it does not. In the video i recorded, the car gets hit in corner. It is so obvious that this is a bug. It got hit so hard that normally it must rotate. This is not about correct/notcorrect values. This is more about unexpected behavior. Lowering timestep? I have messed with that so much and was helpless. I dont understand no one had pointed this out since asset release since it is clear this issue is there since NVP 1... Sorry for saying this but i will have to move to different asset if this isnt resolved for production.
     
  37. Guacamolay

    Guacamolay

    Joined:
    Jun 24, 2013
    Posts:
    63
    I'm not sure how it's out of context? I wasn't trying to offend you I just wanted to make some suggestions to help you fix the issue, or anyone else who has similar problems. As far as I can see the issues you have are down to Unity Physics, not the NWH system (although NWH has already said they'll look into a solution :)).

    There's always a bit of a learning curve making physics games in Unity, and from my own and other developers experience, you always need workarounds to make the physics act how you want them to (and not go too crazy). There's lots of reasons that the car would pop off like that as I mentioned above, and Unitys Physics are not deterministic which is why you get what seems like random results each time. In real life the car isn't a rock solid block, it crumples on impact and the energy from the impact is disappated. But in Unity that doesn't happen - It uses Rigidbody Physics so your car is technically a rock solid block and the energy from the crash affects the car is a very different way. (In the future maybe soft body physics will become the norm for Unity and we can have nice BeamNG type crashes :))

    Anyway that's it from me, I just wanted to explain why some of these issues might be happening from my own experience.
     
  38. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    Okay, so I spent a few hours on the collision issue.
    The conclusion of it all, after running over 50 collisions, that it is exclusively tied into the fixed delta time.
    With dt of 0.01ms (100Hz physics update) I was not able to reproduce the issue but with 0.06ms (~16Hz physics update) I have ran into it each and every time. Since fixed delta time is not fixed and has minimum and maximum values it could be that on some hardware the demo scene with the rear view mirrors (which are cameras so things are rendered multiple times), vegetation, etc. is causing fixed delta time to increase and therefore the behavior shows up.

    If I had to guess why this happens, it would be for the same reason that the bullets pass through walls when going fast and walls are thin - only in this case it is the vehicle that 'dives' into the terrain, only for the depenetration code to react and apply the force. That force is applied along some type of normal, but if the vehicle partially moves into the terrain collider the normal can not be accurately calculated and any surface features of the terrain just get ignored. I have also observed this when testing Physics.ComputeDepenetration earlier last month.
     
    overthere and GLID3R82 like this.
  39. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    157
    Really cool development @shahzaib !

    Just curious, are you using raycasts? or Spheres or Mesh colliders? Any advice on doing something similar?

    Thanks!!
     
  40. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    I am going to assume DOTS. The testing I did with DOTS showed good results but the whole Physics package is only in preview.

    There are a few other non-DOTS approaches but ALL of them have a downside, e.g. they work only with convex colliders (therefore not with Terrain). The first version of WheelController, way before release, used both SphereCast and SphereCollider but that had a lot of issues, not the least being the shape. Using mesh collider for the wheel is also possible but the results are far from perfect. That is why the WheelController is using Raycasting at the moment. And before you say that Raycasting is expensive I would disagree, especially when done in Batches. In fact 90 percent of the performance on WheelController goes to calculating friction, geometry, suspension forces, etc.
     
  41. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    157
    Hi @NWHCoding ,
    Thanks for the reply!! The reason I ask isn’t about performance I’m actually interested in how to improve interactions all around the wheel especially on the top of the wheel. I was wondering if a raycast setup could do this or if a collider based approach might work better.
    Thanks for any thoughts!!
     
  42. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    DOTS and Physics package from Unity introduced a lot of options and I will make a poll in the future about the amount of people using the technology. I did some research around the forums and it seems that at the moment DOTS is not there yet, at least for production.
     
  43. Juanola_

    Juanola_

    Joined:
    Sep 29, 2015
    Posts:
    33
    Hi! I was about to buy the package, when I saw physics 2 is about to be released soon. Do you know when is going to be available? Should I wait before buying? Thanks!
     
  44. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,881
    I needed a big car to test something, so I modified the NWH Vehicle Physics demo scene and added MicroSplat Trax:



    What I wish for: It would be awesome if the documentation could be updated to contain a quick setup. All I want is to drag in a car prefab and drive with it when I hit the play button. But of course with dust and such. I managed to do this in the end, but I think it would be nice for others as well.

    Next is the Tank :D
     
    NWHCoding and newlife like this.
  45. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    It has been submitted on Wednesday and it usually takes 1-3 days for an asset to get approved, but all the holidays and the situation at the moment will probably delay that a bit.
     
  46. Juanola_

    Juanola_

    Joined:
    Sep 29, 2015
    Posts:
    33
    Do you know what will be the price?
     
  47. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,272
    The full price will be $74 (compared to initial price of $60 for NVP1) but the existing customers will be able to upgrade for $30 (40% of the price). Of course there will be sales where the asset will go for $44, but I can not give you the dates of those depend solely on Unity.
     
    GLID3R82, krou and RichardSim like this.
  48. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,881
    @NWHCoding It would be cool if you could support spraying particles when you drive over sand and mud. I only saw dust and smoke. Also splashes for rain / wetness.

    Basically adding custom particle effects would be nice.

    Edit: I tried briefly, it does add to the overall experience:

    tx.jpg
     
    Last edited: Apr 12, 2020
  49. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,881
    I kinda love the versatility that NWH Vehicle Physics has in cars. Will we see even more? And does the asset work with bikes as well? If so, an example scene would be awesome. Like dirt bike and race bike. Definitely quad bike like I mentioned a while ago.

    I'm having such a blast with the different vehicles. I mean, creating this was just a matter of a few hours, most if it was learning how to interact with particles. The tank itself worked out of the box. Then it was just a matter of duplicating instances:



    :D

    Can't wait to test the 8-wheeler, but I wait for Vehicle Physics 2 for that. The promo video looks too impressive.
     
  50. aka_alarm

    aka_alarm

    Joined:
    Oct 15, 2014
    Posts:
    1
    Wow! Man this is stanning. Does it allow to set differential between axles?
     
unityunity