Search Unity

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. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    Just copy the provided input settings as per readme and you will be good to go. Dependency on standard assets is just for demo scene. I am not planning on doing my own trees, water and character controller just to avoid two clicks doing the import of the package. And besides if you are not using demo scene those Standard Assets are not needed - you can use any FPS Controller and any water solution, this is just for example.
     
    JeyP4 likes this.
  2. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    No because this would require people to purchase another package. What I am going to do is integrate it with the Unity's new inpit system that is currently in beta in 2018.1.
     
  3. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,022
    Hi, is it possible to make vehicles without suspension like a Kart?
     
  4. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    No. And it never will be using Rigidbodies inside unity. You will have to use physics approximation without rigidbodies to achieve that, or could use stiff suspension since tires on a kart have some 'travel'. Note that even if you made a cart with default physics colliders such as spheres for wheels and joints for suspension it still would not work.
     
    GLID3R82 likes this.
  5. SilverSho0t

    SilverSho0t

    Joined:
    May 10, 2013
    Posts:
    13
    Hi NWHCoding it could be interesting for more optimization to use this ?
    Capture.PNG
     
  6. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    Nice tip. I will wait a bit until the job system gets out of beta. Raycast itself is currently really only a small fraction of the performance (<5%) cost. I was looking at the job system for procedural mesh generation for one other project and decided it still needs some time to get there. But FINALLY Unity is going in the direction of being to run engine specific functions on multiple cores - in my opinion that should have been done about 5 years ago :)
     
  7. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,022
    OK, thanks for the reply.
     
  8. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    Here is a look at the improvement to the tank I was talking about earlier (and tracked vehicles in general).
    There will be a coefficient under the tracked vehicle dropdown. This coefficient will be used to increase the size of the wheel (just on the calculation size) to make the surface area of the track more flat. This is possible because the wheels can overlap without any complications and enables the tank to not get stuck on different smaller obstacles.
    Other than gizmos there are no visual changes and everything gets set up automatically.

    This is what that looks like inside the editor:
    Capture.PNG
     
    overthere, GLID3R82 and Rotary-Heart like this.
  9. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,463
    Please make your input system that it can be easily override it (e.g. virtual function) so we can use alternative input systems (e.g. Rewired).

    Unity's new input system is still a preview (not a beta like Unity 2018.02) based on Unity's post here:

    https://forum.unity.com/threads/input-system-update.508660/page-5#post-3474242
     
  10. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    But it already is easily overrideable, that is how it was designed to function. Just access e. g. vehicleController.input.Handbrake, Vertical, Horizontal or whatever is needed and set it to your value without using the provided input managers. The input is separate from the vehicle itself and vehicle does not do any input getting itself but requires extarnal script to set the values (which by default is DesktopInputManager) . Check InputStates.cs script.
     
    overthere likes this.
  11. thegreyman1

    thegreyman1

    Joined:
    Jun 10, 2010
    Posts:
    164
    Got the input to work btw. Had to reimport a bunch of standard assets and reset my input settings which was a pain. But now I'm getting a worse problem. The physics are crazy, rolling over small props or even landing on the ground after a small jump creates a crazy rebound that bounces me around for ages. Is this a known issue?
     
  12. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    The only standard assets that need to be imported are Environment and Characters anf that is ONLY if you are using demo scene. Input settings do not need to be reset but the easiest way is to just copy the provided ones, and if you do not want to do that you can set them up yourself in about 2 to 3 minutes in the settings. I will add this as a step by step section in manual since it seems to cause confusion, despite following the Unity input manager policy and not having any inputs hardcoded.

    The other problem you are having is not a common one and always the result of inproper setup - most likey too low max spring force or too low spring travel. Are you having the problem on your own vehicle or the demo scene vehicle. Sharing the Wheel Controller inspector screen would help.
     
  13. cybersoft

    cybersoft

    Joined:
    Feb 12, 2014
    Posts:
    85
    Hi NWH,

    This seems to be great car driving asset or maybe the best one now. I have your asset on my "must have" asset list but only one thing worried me. Integrations with other major assets. Maybe you have a list of all your integrations?

    Examples:
    - Adventure Creator
    - Easy Touch
    - InControl
    - ORK Framework
    - Playmaker
    - plyGame
    - PuppetMaster
    - EasyRoads3D
    - etc.

    Edy's Vehicle Physics is compatible with almost all important assets like: third person controllers, FPS, scripting tools, game toolkits etc.

    But there is a good sign:

     
  14. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    - Third person controllers are supported in general because the character vehicle changer was made to be generic and work with anything as long as that anything is a gameobject of some kind.

    - EasyRoads3D work just fine (the road mesh inside the demo scene was created using Easy Roads 3D).

    - Racing Game Template 2.0 will support NVP (or so the author says).

    When developing NVP I went for it being universal so that it can be easily adapted with any of the 3rd party assets rather than adapting it to work with one. If you need help setting it up with a specific asset contact me via email.
     
    GLID3R82 likes this.
  15. cybersoft

    cybersoft

    Joined:
    Feb 12, 2014
    Posts:
    85
    Great to hear that! :)
     
  16. obstudio

    obstudio

    Joined:
    Sep 30, 2016
    Posts:
    55
    As for the flip option - user shall chose if car shall flip (like now) or respawn (like in many games).

    I've playing a little bit with rewired (it's pretty easy to integrate with your asset), but:
    I found that there is lack of camera movement (there is only in cameraMouseDrag after mouse press). Think about onboard free look around (or just lean with getting back to start position) with use of buttons (or mouse). Check cameras in car games that you play there are some nice features like quick look back.

    Mirrors onboard are looking great - but there is lack of mirrors (with keyboard shortcut to enable them) on cameras like dashcam or bumper cam - what I mean is a rectangle with back view.



    And last thing that may be helpfull for your asset users are shortcuts for enabling/disabling car modes like in real cars:
    - button for disabling traction controll
    - button for enabling sport mode in some cars
    - button for enabling 4x4 or locking differential
    - and for NOS :)
     
  17. SilverSho0t

    SilverSho0t

    Joined:
    May 10, 2013
    Posts:
    13
    I was going to ask but you add it before ;) -> Damage.Repair() function

    Any ETA on update?
     
  18. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    Update v1.6 has just been pushed to the Asset Store. It will be available for download as soon as it gets approved by the asset store team.

    Changes:
    • Fixed vehicles jumping / flying into the air under some specific circumstances.
    • Add option to freeze the vehicle when inactive.
    • Improved tracked vehicles
    • Added Repair function (vehicleController.damage.Repair())
    • Fixed bug where Mobile Input Manager would throw error if Vehicle Controller was not assigned, and Vehicle Changer was.
    • Vehicles with larger wheels sometimes hesitate when changing from reverse to first gear.
    • Error when detaching the trailer in some cases.
    • Solved emissive meshes not emitting in demo scene build.
    • Fixed RPM being off on the RPM gauge inside the demo scene.
    • Remove leftover tutorial scene.
    • Removed delay when shifting from reverse to forward.
    Check the list above :)
     
    overthere, Rotary-Heart and GLID3R82 like this.
  19. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    318
    I tried to make the "Monster Truck" work in this scenario, but it goes through virtually every corner, just play around for a bit to see the bugs.

    https://assetstore.unity.com/packages/tools/physics/ms-vehicle-system-free-version-90214
    ________________________________________________________________________
    Seriously, I created my own vehicle asset, but I was disappointed with the "Wheel Colliders". So I bought the NWH hoping the problem was solved, but apparently it's worse.

    The WheelController3D slides much more, suffers from "shaking" problems and is very unstable with respect to walls.

    I'm not getting the stability I was looking for.

     
    Last edited: May 10, 2018
  20. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    Look, if you are not satisfied with the purchase I can offer you a refund.
    I explained earlier why the shaking might happen and how to fix it, and in manual too, but I will repeat it:
    a) Either lower the center of gravity.
    b) Use 0.016 fixed delta time.
    One of the two above.

    Wheel Controller 3D on the other hand can be adjusted easily to not slide at all by adjusting the curves or coefficients, and provided is just the default behavior.

    Also note that you are not allowed to redistribute any part of the code from NVP/WC3D inside other assets so following the Asset Store policy WC3D cannot be included inside your vehicle physics.
     
    Last edited: May 10, 2018
  21. Aladinho

    Aladinho

    Joined:
    Jul 18, 2013
    Posts:
    7
    Can you show sample how to set up for Rally car? I try activate drifting but it not quite like what I want.

    Same as this
     
  22. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    318
    Does "Wheel Controller 3D" no longer come with NVP?
     
  23. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    Of course it does. NVP would not work without it, but both are done by NWH Coding and as such it is allowed. I was just mentioning that WC3D cannot be resold as a part of other assets by other authors - just standard Asset Store ToS/EULA. Sorry for the misunderstanding.
     
  24. Marcos-Schultz

    Marcos-Schultz

    Joined:
    Feb 24, 2014
    Posts:
    318
    Oh yes, sure. It's good to report.

    My intention is not to resell or anything. I'm looking for a "3D wheel" for a personal project.

    The asset I have in the Asset Store is 100% based on wheelCollider, and will be this way forever. (By the way, I will not evaluate your asset in the AssetStore because I do not think it's right for a "competitor" developer to evaluate another developer. So I will not give my opinion on the page of your asset: D).

    Your asset seems to be much higher than mine, so I decided to buy it for my personal project. I'll try to follow the suggestions you made regarding 3D wheels and see if I can lessen their instability.
     
  25. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    Ah, good to know :)

    If you need any more in-detail help just shoot me an email since I respond much faster there and can share the code, etc. Mail is in description.
     
  26. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    I would suggest starting with the following:
    - Lower the force coefficient on the rear wheel controllers.
    - Move center of mass slightly forward (Z axis).
    - Enable drift assist (or do not if you want easier spin-outs)
    - Play with toe angle and Ackermann steering. Changing the toe angle to a positive toe will make it more squirrely.

    Just a warning tho - the thing with the above video is that it does not have anything to do with physics and it is pure arcade (i.e. there is a bunch of code that creates that behavior - translation, rotation, etc., no actual physics involved) and as such exactly the same result will be impossible to achieve.
     
    JeyP4 and GLID3R82 like this.
  27. JeyP4

    JeyP4

    Joined:
    Mar 6, 2018
    Posts:
    16
    Hey @NWHCoding

    I am working on NWH Vehicle physics.
    I understood why u want to calculate all physics at fixed update.

    1. What I don't understand is, why in DesktopInputManager script you are taking values in Update() not in FixedUpdate()?

    2. Why in the input of 'Vertical' axis, you are using 'GetAxisRaw' not 'GetAxis'? Are you using any smoothing function inside somewhere? OR you just want to simulate full throttle only?

    3. Is there any way, I can apply brakes without going in reverse after zero speed ? (Without using handbrakes). Because generally in reality you press brake pedal only.. :). Can we provide a dedicated input key for just brakes only!!

    Thanks..
     
    Last edited: May 14, 2018
  28. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    1. Desktop Input Manager runs in Update() because it runs once per frame, while FixedUpdate() might run less than once or two or more times depending on settings. Really, if you want you can change the Update() to FixedUpdate() and you will not see a difference (except if you have 2FPS or so at which point it would be unplayable anyways).

    2. The only difference between the two is smoothing. I wanted to have more immediate throttle response. Note that both go 'full throttle', it is just that one goes a bit slower than the other. Again, you can try replacing one with other to see if you like the effect.

    3. At the moment no but the option will be added. One other customer has requested it recently too and so I will add this as an option. That option would make the car go into reverse only if the button for reverse (default "S") was released and pressed again. I understand the idea of different button for brakes but I so far have not came across a game that does it. Will add a few options in this area, such as split vertical input.
     
    GLID3R82 and JeyP4 like this.
  29. JeyP4

    JeyP4

    Joined:
    Mar 6, 2018
    Posts:
    16
    Hey @NWHCoding
    Thnx for ur reply.

    Releasing and pressing again identification is a good idea. If you have some idea now how to do it, share with me also.
     
  30. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,120
  31. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    The sale ended on May the 12th. I have removed all the sale references from the videos, titles, etc. but Unity Asset Store admins decided to leave the promo page be. I do not have any say in that and do not know why.
     
  32. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    205
    I sent an e-mail over on 5/13 with a few questions but never received a response. I just resent today. Can you check and see if it's in your spam folder?

    Thanks,
    Reggie
     
  33. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    I have just checked both inbox and spam and nothing. I will PM you my personal email (without any redirection) so please do try that. Sorry for the complications.
     
  34. Aladinho

    Aladinho

    Joined:
    Jul 18, 2013
    Posts:
    7
    How can I make skid mark when hard brake ?
     
  35. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    Disable ABS and make sure that the max brake torque under Brakes foldout is high enough to lock the wheels. Do not overdo it tho.
     
  36. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    205
    I replied to your message on the forums and sent the e-mail again to your address. Did you receive either?
     
  37. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    Yep. There should be a reply in your inbox. Sorry for the complications.
     
  38. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    205
    Thanks, I received your e-mail and replied with a few attachments to show an issue I'm having. Did you get that reply?
     
  39. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    Got it and responded to it a few days ago.
    Writing this just so that the audience is not kept in suspense :)
     
    farfadet46 and reggie_sgs like this.
  40. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
    Hey
    I need this option too... but the behaviour I need is a forward/reverse toggle button, brake button and accelerator button on mobile platform. This is a very common UI.
    Can we easily disable the down shift below neutral when braking and just apply brakes? to a stop. Then have function to drop into reverse? (This might already be there?) sorry Ive just started testing the package.

    Cheers
     
  41. GreeneMachine

    GreeneMachine

    Joined:
    Jul 3, 2015
    Posts:
    126
    Just had another look at this and disabled the down shifts into reverse in transmission script when in neutral or forward.
    But a brake should apply brakes, so why do I roll back when on a hill, even though Im pressing the brake key?
     
  42. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    205
    I have my own vehicle system for managing players in and out of vehicles so I'm not using the vehicle or player changer scripts. As best I can tell, I can set the Active field on the main vehicle script to inactive when a player is not driving the vehicle then set it to active when the player enters the vehicle. I set it to inactive when the player leaves and everything works fine but the engine cut off sound doesn't seem to play. I've dug around in the code a bit and it seems to be related to the engine stop timer. Is there something else I should be doing for players entering and exiting vehicles other than just updating the active field?

    Thanks
    Reggie
     
  43. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    I would suggest cheking out the Suspend() function inside VehicleController and removing the engine.Stop() call. This will make the engine run even after exiting the vehicle. I will be making some improvements that have been requested via email and here and are related to gears and logitech wheel input in the next version which will be out in about 10 days.
     
  44. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    205
    Thanks but the problem is I want the engine to stop running when the driver exits. I'm just not hearing the stop engine sound play right now. I was wondering if what I was doing (changing the active field) was the correct way to exit the vehicle. Should I use Suspend instead of modifying active directly?
     
  45. NorbertoSanders

    NorbertoSanders

    Joined:
    Dec 7, 2017
    Posts:
    20
    1) When the car collides on a wall, and the mesh kneads, and the character approaches the crumpled mesh, it gets stuck at this point.
    2) The stationary vehicle is moving too slowly. Slip on the wheel colider a few mm per minute.
     
  46. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    1) This one is actually not a bug but the mesh collider does not get recalculated when deformations happen. Initially this was in there but recalculating the mesh collider is very expensive and can last a few seconds, esp. on mobile devices. This blocks the main thread for the duration of recalculation resulting in a freeze.

    2) Have you tried checking "Freeze When Inactive" option under General?
     
  47. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    If you can wait for a few days I will fix this along with other reported issues during the upcoming week. Most likely cause is the audio source being stopped too early (most components of the NVP are not updated when vehicle is suspended, and if the engine gets suspended too soon engine sound will be shut off too early too).
     
  48. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    205
    Thanks, there's no rush just yet. We're still a month out from releasing.
     
  49. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    205
    Ok, just ran into another issue. When a remote player gets in the vehicle, their colliders were colliding with the wheel colliders so I set the wheel collider's ignore mask to ignore them. That works fine but the ground detection script seems to be detecting a collision with them still and is making surface noise when a remote player is just sitting in the car.

    It seems like the wheels are using the ignore mask for collisions but not for generating road noise. Is there a quick way to make them ignore the remote player's colliders?
     
  50. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    958
    Hmm, might I ask if there are skid noises or surface noises? Skid would be squealing and surface would be noise or rolling tire. The same raycast data is used for both ground detection and effects.
    Could you go to the wheel that is affected, switch the inspector into Debug mode, lift the vehicle into the air and check if "Has Hit" boolean is checked?
    Also, while the vehicle is making the noise and your player is inside, please check the values of the following circled fields:
    upload_2018-6-5_10-54-19.png

    Surface sound component at the moment is calculated only if wheel has hit / is grounded and only from slip data and speed. Skid sound component is about the same but here the force on wheel modulates pitch.
     
unityunity