Search Unity

Dynamic Water Physics 2 [Released]

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

  1. ThomasJacksonMAI

    ThomasJacksonMAI

    Joined:
    Oct 20, 2023
    Posts:
    5
    Thank you I am looking into this now.
    Another issue I have run into is setting input.SubmarineDepth or input.states.submarineDepth via code, I can access the throttle and steering values fine but the SubmarineDepth has no effect. Pressing I/K work but I need this to be controlled by a script.
     
  2. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,688
    To set any of the inputs through scripting make sure to set the shipController.input.autoSettable = false; as otherwise any InputProviders present in the scene will overwrite the values. That is the most likely culprit, although I am not sure why the other two would work in that situation.
     
  3. ThomasJacksonMAI

    ThomasJacksonMAI

    Joined:
    Oct 20, 2023
    Posts:
    5
    Thank you, I have tried this and I can see this being reflected in the input section of the AdvancedShipController but there is no effect on the vessel.
     
  4. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,688
    If the ship is enabled and auto settable set to false, it does not matter where the input comes from. I would check the two mentioned things first.
     
  5. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,688
    NWH Vehicle Physics 2 and Dynamic Water Physics 2 are currently both 50% off as a part of the New Year Sale!
    Check the links in the signature below.
     
  6. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,688
    I just went through the code and the issue is this:

    Code (CSharp):
    1.            
    2. DepthInput = InputProvider.CombinedInput<ShipInputProvider>(i => i.SubmarineDepth());
    3.  
    In the Submarine.cs. It should be replaced with
    DepthInput = shipController.input.SubmarineDepth;


    I believe I originally did this to remove the dependency on the ShipController. You will need to get the reference to shipController somewhere in the script and that should solve the issue. Also, will be adding this to the TODO for the next update.
     
    Mark_01 likes this.
  7. ThomasJacksonMAI

    ThomasJacksonMAI

    Joined:
    Oct 20, 2023
    Posts:
    5
    This is working thank you. When I am trying to get the boat to sink, I need to add almost 1000 times the current mass of the ship in order for it to start sinking and at that point just keeps sinking. How can I make the vessel neutrally buoyant at a certain depth? It seems it is only positive or negative at the moment
     
  8. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,688
    Assuming that the density of the object is the same as the density of the water it will be neutrally buoyant, but even a small discrepancy between the two will result in the object going slightly up or down.
     
  9. ThomasJacksonMAI

    ThomasJacksonMAI

    Joined:
    Oct 20, 2023
    Posts:
    5
    How can I check the density of my object?
     
  10. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,688
    Sorry for the delayed response, forum sometimes does not send out notifications. There is a MassFromVolume script where you can select the density.
     
  11. Stefan_Uhlenberg

    Stefan_Uhlenberg

    Joined:
    Sep 27, 2021
    Posts:
    2
    Can we get support for the built in Unity 2022.2 HDRP water surface?
     
  12. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,688
    Hello, there is an unofficial script on the NWH Discord (link in signature), but it will be added officially soon too. I was waiting for the API issues get resolved as in v15 there was a change and the new API (at the point of testing) did not have the data required. It has been fixed since, I just have to update the asset to include it officially.
     
    web76 and Stefan_Uhlenberg like this.
  13. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    Any update on this? I am on Unity 2022.3
     
  14. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,688
    Not yet, but the script is still on the official Discord.