Search Unity

Dynamic Water Physics 2 [Released]

Discussion in 'Assets and Asset Store' started by NWHCoding, Jul 3, 2019.

  1. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Dynamic Water Physics 2 will be on sale for 10 more days.
     
  2. AnoyHowlader1234

    AnoyHowlader1234

    Joined:
    Sep 30, 2021
    Posts:
    1
    How to Use another script to move a floating object?
     
  3. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    WaterObject just uses plain Rigidbody for physics. So you can do something as simple as
    myRigidbody.AddForce();
    .
     
  4. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    An update is on the way.

    2.6.1

    09/05/2022
    • Added KWS support.
    • Fixed very small triangles getting ignored by simulation.
     
  5. Da-Luk

    Da-Luk

    Joined:
    Apr 25, 2017
    Posts:
    53
    Hey, after updating to 2.6.1 I cannot use 2 raycast water data providers at the same time. I need 2 because I'm using 2 layers for 2 different water. I tried to use only one but I don't know how to combine 2 Layers on the Ignore physics collision "Physics.IgnoreLayerCollision(waterLayer, objectLayer);"
    Any ideas?
     
  6. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    The much requested multiple water asset support in the same scene unfortunately removed the ability to have two active at the same time in the same spot as the one that has been entered (trigger volume) last will take priority.
    However, if these two waters are at different positions, using trigger colliders that cover just the one you want to be active at that time will do.
     
  7. Da-Luk

    Da-Luk

    Joined:
    Apr 25, 2017
    Posts:
    53
    Thanks! Everything fine now.
     
  8. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    A small update with friction circle settings is coming out today.
    These settings are too important for vehicle handling to not be adjustable. These determine how the vehicle will behave under heavy breaking or acceleration when slip is high, how it will handle wheel spin, wheel lock, etc. so being able to adjust these, while complicating the inspector a bit further, is important for vehicle setup.

     
    Vincent454 likes this.
  9. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,300
    Checking out the asset in the latest LTS version with Crest and Water Interaction Spheres:

     
    StarChick971 and Vincent454 like this.
  10. calculmentor

    calculmentor

    Joined:
    Jun 25, 2014
    Posts:
    11
    hi there!
    I'm facing some issues with crest data providing...
    U_2021.3 lts
    Crest : Version 4.15.2 - May 19, 2022
    DWP: Version 2.6.2a - June 20, 2022
    upload_2022-10-20_16-24-10.png

    any idea ?
    thx you !
    nicolas
     
  11. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hello, it seems like the Crest assembly was not referenced within the DWP2.asmdef file.
    Check the text in orange in here (towards the top): WaterAssets [Documentation for Unity] (dynamicwaterphysics.com)
     
    calculmentor likes this.
  12. the_unity_saga

    the_unity_saga

    Joined:
    Sep 17, 2016
    Posts:
    273
    hello dev, hello again and great work!

    um

    now that synchronize() method is removed, and water object manager is depreciated, what do we do to instantiate water objects after runtime?

    for some reason im getting behaviour of sinking objects such as ragdoll prefab after runtime

    but when I duplicate one already instantiated, it works???????

    im trying to integrate

    https://assetstore.unity.com/packages/tools/terrain/r-a-m-2019-river-auto-material-2019-145937

    everything is mostly working except for adding newly made object to water and have it have correct bouyancy

    thanks again for your hard work
     
  13. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hello,
    if the prefab is already set up with the WaterObject script it should just work. Everything is done on Awake() and Start() - removing the complication behind the Synchronize() was the main reason for the change after all.

    Is the prefab already set up and does it work if it is set up in the editor prior to entering play mode? I have not had a similar bug report yet so I am interested in what might be happening.

    Finally, please consider joining our Discord (link in signature) or sending an email for faste response time to support requests.
     
    the_unity_saga likes this.
  14. the_unity_saga

    the_unity_saga

    Joined:
    Sep 17, 2016
    Posts:
    273
    ok, thanks for the response as I was able to narrow it down to any object not set up as a prefab with correct object tags will not float, unless its a prefab with tags already set
     
  15. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Interesting, I am not using any tags for the WaterObject.

    Gave the source code a look and the issue is WaterObject.GenerateSimMesh() is not called. Hence the behaviour.
    There is an example on how to generate the WaterObject from script (not instantiating a pre-generated object, but creating a completely new one) in the WaterObjectFromScript.cs. In this case I would suggest using the lowest LOD mesh and not using the simplification options that are in-built since they are not really written for real-time mesh decimation/simplification performance-wise. Especially if the mesh has tens of thousands of triangles.
     
    the_unity_saga likes this.
  16. the_unity_saga

    the_unity_saga

    Joined:
    Sep 17, 2016
    Posts:
    273
    Well, I checked again, and

    honestly I don't know whats going on,

    the boat I had without tags just worked fine. but the character prefab didn't

    but it did when tags.. were set... before han-

    my head really hurts and this seems to be the Unity way.

    Thanks again!!!!!
     
  17. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Both NWH Vehicle Physics 2 and Dynamic Water Physics 2 are 50% off at the moment.
    Check the links in the signature for the assets in question.
     
    the_unity_saga and StarChick971 like this.
  18. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Both NWH Vehicle Physics 2 and Dynamic Water Physics 2 are 50% off at the moment as a part of the Unity’s New Year Sale.

    Check the links in the signature for the assets in question.
     
    Vincent454 likes this.
  19. GandalfWhiteSR

    GandalfWhiteSR

    Joined:
    Aug 10, 2017
    Posts:
    1
    I'm struggling with the implementation of my logical gameplay with a workable asset.
    In documentation says that I should get the input from individual InputProviders:
    float throttle = InputProvider.Instances[0].Throttle;


    and I've tried to use this code:
    shipController.input.Throttle = 0.5f;
    shipController.input.Throttle = -0.5f;

    And I thought to get access directly to the component:
    public AdvancedShipController shipCltr = gameobject.GetComponent<AdvancedShipController>()

    but every points the script is yelling on me that it's not working.
    I'm using also Crest for ocean simulation.
     
  20. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hello and sorry about the confusion. You are on the right path.

    This part of the docs is quite important:

    In case input should not be retrieved from user but from another script - as is the case when AI is used - AutoSettable should be set to false. This will disable automatic input fetching from the active InputProvider.
    so all you need to do is add
    shipController.input.autoSettable = false
    beofre your throttle setting line.
    Hope that helps.
     
  21. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    v2.10

    15/04/2023
    • “VehicleReflectionProbe” and “FollowVehicleState” are now in Common code and available in DWP2.
    • Fixed GC issue with Mathf.Min.
    • Exposed “Awake On Start” option in Settings.
    • Added underwater fog to the demo.
    • Fixed WaterObject spamming prefab Overrides.

    v2.9


    12/04/2023
    • Common code update.
    • 'registerWithVehicleChanger' and 'autoFindVehicles' have been removed as they add unneeded complexity. Use VehicleChanger.Instance.RegisterVehicle() and DeregisterVehicle() after spawning a vehicle instead.
    • Vehicles no longer get woken up automatically if VehicleChanger is present and active.
     
  22. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Added underwater fog to the demo scene to make things look a bit less jarring once camera goes under:




    "VehicleReflectionProbe" and "FollowVehicleState" are now in Common code and available in DWP2:

     
    dsilverthorn and StarChick971 like this.
  23. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    I’m having a lot of trouble getting DWP2 and NVP2. I’ve tried using the 1st person controller that comes with vehicle physics and adding in DWP2 and doing it in reverse. But not having any luck. I have my own controller but want to see it working with your simple fpc before integrating. I’ve seen that you have tested your assets together so I know it can work.
    Can you provide a simple controller setup like you did with the vehicle that works on both assets? Or a step by step tutorial for DWP2.
    I can’t seem to get this figured out.

    I’m creating a game where you can go from boats to on foot to cars to horses. If all gets working I might purchase your flight dynamics and add planes to the fold. Can you help me out on this one?
     
  24. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hello,
    this should work just fine out of the box. Any specific issues you are encountering? If there are any these can be considered bugs and I will get to immediately fixing them. You should be able to get out of a car and get into the boat and vice versa, it is just important that all 2 (or 3) asset versions are all the same (i.e. the newest). There were a lot of changes to the Common framework code recently so this is especially important.

    Edit: I have a project/scene with all 3 assets present so will test this.
     
  25. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    Thanks
    I was getting errors when adding both together. I tried an empty project but haven’t been able to get them to work yet.
    I’ll try it again and let you know. I’m currently testing with Unity version 2021.3.19, should I change version?
     
  26. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hmm, not getting any errors. Are you sure that you did a clean import (when importing)? I will go and re-upload NAE and NVP2 to make sure all 3 are on the exact same Common versions right now.

    Please wait about an hour, then remove the NWH folder, in Package Manager click on re-download on all the packages and then Import.
     
  27. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    The update should be visible around now. I have not upped the version number as there were no (known) changes, could be just that the Common code was a few days out of date on some of the assets.
    Made a test scene:
    upload_2023-4-15_16-38-43.png

    0 errors or warnings entering and exiting, both with character-based vehicle switching and instant switching.
    So I would suggest following the steps above and doing a clean update and it should work, no warnings or errors.
     
  28. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    started a new project with just VP2 and DWP2 and no errors- both versions now updated to new release.
    I've opened the VP2 demo scene and added the racer. had to adjust the scene to bring water level to 0.
    Replaced water with water from DWP2 and added flat water data script.
    added racer to vehicles in scene manager.
    I can switch vehicles but the ship controller isn't working- so I must be missing something. The motors don't move and no movement of boat.
    I tried with the FPC and it will not enter the boat.
    I know I must be missing a step.
    will try with a blank scene like you show
     
  29. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    ok. I was missing the enter point- because cars are using it. Added that and I can enter.
    but ship controller still; not working.
    How do you switch from vehicle controller to ship controller?
     
  30. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    I tried going in reverse from DWP2 demo, added the Niva to the island. using FPC can walk to boat, get in and drive, exit and enter car. but vehicle controller will not work. Same as the other but in reverse. What step am I missing?:confused:
     
  31. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    Got it working!!!!
    I was missing the other input provider.
    Thanks for checking on your end.
    The new versions fixed the errors I was getting when using both together.
    Now I'll try implementing my controller. Progress is a good thing.
     
    NWHCoding likes this.
  32. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Sorry for it being confusing. I will definitely add a warning on the missing enter exit point and improve the integration between the three. A missing InputProvider warning might also be a good idea.
    A demo scene with all 3 in it is also in the planning.
     
    dsilverthorn likes this.
  33. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    I really appreciate it. Before the last update I was getting bool errors on DWP, but not anymore. So I only concentrated on the boats. Now I can bring in the vehicles.:)
    Now that I understand it better, it should not be a problem.
    I just need to make my character float so it can reach the boat to get in.

    One request: a tutorial video on DWP2 setup for our own boats. I am getting bad results while trying to build a fan driven swamp boat. It is probably my model set up, but I just feel like I'm winging it, not really knowing what to do.:confused:
     
  34. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Noted. The current docs say how to setup them, but not how to tweak the behaviour.
    In the meantime a few things to consider:
    • Inertia and center of mass of the boat are very important.
    • Adding artificial keel using a scaled Cube with MeshRenderer disabled can be useful for the boat to better keep the direction.
     
    dsilverthorn likes this.
  35. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    Yes. It is the tweaking that I’m talking about.
    Initial setup is very easy. And I love that there is a manual, not everyone provides that. I think what I’m looking for is an example of the reactions to each setting and what to look for.
    it might be me, but the vehicle setup was easier to understand and I think it is because there are more examples online of the setup.
    But I am experimenting and will get it.
    These are AWESOME assets and I really appreciate your support. Thanks for helping me on the weekend!!
     
    NWHCoding likes this.
  36. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    Hello again,
    I'm having trouble getting RAM to work. I have tried following the directions :"If the file is missing create one by Right Click > Assembly Definition. Name the file the same as the asset" and added reference to the DWP asmdef.
    I can get it to work with the raycast data water provider, but then I do not get moved by the current.

    I have created a .asmdef named RAM and tried "River Auto Material" as the folder is named, but I still get errors from the RAMWaterDataProvider that namespace could not be found for all RAM functions. ('LakePolygon' & 'RamSpline')

    What should I name the RAM asmdef? I assume I am using the wrong name on the asmdef and that is why I cannot use the RAM water Data provider.
     
  37. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hello,
    name actually does not matter, it is just important that you add whatever asmdef you create under the DWP2 asmdef references so that it can "see" the RAM. Not sure why RAM is not including the asmdef by default as that is the Unity Asset guideline.

    I am back in office on Friday so I will test if RAM works properly, but from the errors I would say that it is definitely an assembly reference issue.
     
    dsilverthorn likes this.
  38. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    Ok. Thanks. I'll keep working on it and let you know if I get it working.
    Even with the RAM.asmdef created and added to the DWP asmdef, it doesn't even recognize the RAM water data provider script and won't let me add it.

    Does anything need to be added to the RAM.asmdefother than just creating the file?
    Do I need to reference DWF in RAM.asmdef?
     
  39. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    No need to add anything in RAM. Have you defined the scripting define symbol as per manual? That is the only reason, or any errors preventing from compiling, that would make it not show up.
     
    dsilverthorn likes this.
  40. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    I figure I missed something or did something wrong. I’ll run through it again, step by step.
    Too bad your example is for crest. ;)
    I’ll keep on it.
     
    NWHCoding likes this.
  41. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    Ok. I can get it working without using asmdef, but I would like to not have to do that if possible. At least I have a work around. Now I'll try integrating with NVP2 without the asmdef and see if that works.
     
  42. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Back in office today so will give RAM a go.
     
  43. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Tried to reproduce this and did the following:
    • Import R.A.M. 2019
    • Add RAM.asmdef to the NatureManufacture Assets folder through the right click in Project window.
    • Add RAM under assembly references to NWH.DWP2.asmdef file by selecting it in the Project window and then clicking the '+' in the inspector under the references list.
    No errors so far. I did get the errors you were getting before I did the 3rd step.
     
    dsilverthorn likes this.
  44. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    Thanks. Testing again using the steps you indicated.
     
  45. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    When I test in an empty scene with only RAM and NWH assets, I get no errors.

    But when I try it in my project, I get errors. If I move RAM.asmdef to different folders I get more errors adding other assets that didn't produce any errors before.

    I can run DWP2 without errors by removing the asmdef files. BUT...
    What needs to be changed with VP2 to get both working together, if DWP2 doesn't use asmdef?
     
  46. m379681879

    m379681879

    Joined:
    Apr 22, 2023
    Posts:
    1
    Hey bro! I am using your advanced ship controller to control my boat. I have one question that how can i stop the boat immediately? I tried in my script to set throttle = 0 ,but the boat could not stop immediately. How can i make it?
     
  47. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Hmm, that sounds like there might already be an asmdef somewhere in the root of your project or on a higher level than the RAM.asmdef. The RAM asmdef should be just inside the NatureManufacture folder. I would also check for any duplicate asmdefs in that directory, which would explain why it works in an empty project and not in yours. You can also try deleting the two folders (NWH and NatureManufacture) and re-importing.
    In theory you could run everything without .asmdefs but that would tank your compile times and is not a good practice.
     
    dsilverthorn likes this.
  48. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    You can force the Rigidbody velocity to 0, like so:
    shipRigidbody.velocity = Vector3.zero;
    . Or just increase the drag to some very high value (e.g. 100), about the same effect.
     
  49. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    841
    I'll check on that. I use all of NatureManufacture's vegetation, and they are huge downloads. When I add it to the root folder I get errors for Vegetation Studio Pro assemblies. I'll keep trying.
     
  50. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,692
    Ah, yes, once you use .asmdefs you have to use it for everything. I usually sort it out by having a Lib folder with all the assets and a single .asmdef for reach asset, with references as needed.
    But yes, you should be able to run DWP2 and NVP2 just fine together with .asmdefs removed. Just note that without them each time you change any script all the scripts in the project get recompiled, instead of just the assembly.
     
    dsilverthorn likes this.