[RELEASED] Realistic Water Physics 3

Hey thanks, @imtehQ !
That’s got the initial menu/inspector sorted but I think there’s one last step missing.
Entering play mode is moving the center of mass, just without updating the value in inspector.Pic here:


This is kinda… sticky? The green cube for the center of mass stays there when I exit play mode.

Makes me wonder if the inspector isn’t adjusting the center of mass and is just moving the visualizer instead. Just a thought.

Side note: hitting update in play mode, though not recommended, does change the center of mass properly. The center of mass cube move and the behavior is close to what I’d expect. Cube still moves back on exiting play mode though.

@Chrury , Thanks for letting me know i’ll look into it right away!

@Chrury , im unsure why is does this, i have checked everywhere and everytime i start the scene it starts at 0,0,0 then just when the scene is about to start it changes back to what its by default.

As for right now i sorted out the issue by adding a small check to stop is from switching back.
I added a bit more code everywhere to make sure the interface does the updates correct but for that you have to wait till unity updates it.

But for now you can stop it from switching back by adding the simple check at like 1490 or so in the RealisticBuoyancyObject.cs

just below the
private void CalculateAllPhysics()
{```
if(_thisRigidbody.centerOfMass != CenterOfMass)
{
_thisRigidbody.centerOfMass = CenterOfMass;
}

Im working on a patch to solve the inspector issues, a good bypass now is to skip the intire inspector all together by opening debug mode, its in the top right corner right of the lock icon.

It might a few days to work out as i want to add few extra option to it aswel.

Ok small update about the last version, there was indeed a bug in the interface that i was unaware of.

As for right now the asset still works however you can’t change the gameobject settings in runtime nor in the editor without using the interface, this is because i later added the inspector options to the asset by default my idea was to always use the interface window to change settings, this is what’s causing the bug to show up.

I’m going to rewrite some of the core code to solve the issue and while I’m at it I’m going to add a few things i wanted to add before, to make the overall asset better.

This might take some time tough, as my personal life is not allowing me free time.

Another small update,
I had to recode some of the core code to get everything working again, im still unsure how this got past me while debugging everything, ow well its fixed now.

However i had to make a few changes alone the way to get everything working again.

  • For now i removed the subChild support but i will put it back in once refined.
  • I changed some small things like GetMass is not just Mass and stuff like that.
  • One big change is that i completely redone the inspector code, so i removed the fancy menus on it and made it all in 1 window, this will Fix a issue with the menus closing sometimes… and well i got tired of it.
  • I added a options to change mass and stuff on the go, however the inspector window will update it the moment you change it, so be carefull with that. But you have full access to it trough code.
  • Changed the way the points are calculated to, its still used the same points but only does it when you call for it.
    So you can only get the buoyancy script to recalculate its points trough code and no longer in the inspector, this will reduse lagg when using the inspector but will lower its quality a bit when changing settings.

This update will be a bit big, and i still need to update the manual file to match the code.
Refine some small things but I hope to get it done soon,
but currently 4 other active jobs are not allowing me much free time.

If you’re interested in testing this version for me it would help a lot!
Message me if you like to get a experimental version.

Version 3.1 is out, and can be downloaded.

If your updating from another version you need to press the Re-Calculate button on the bottom of the script on each gameobject to make it work again, this is due to update in the way the points-updates are called for.

  • SubChild support has been replaced with a stand alone child support script, well tested and works a lot better then the old system.

  • The options on the inspector got updated to they fix the bug where changes would not save correctly, __bug reported by @Chrury __

  • I Included a demo to show how the asset works with a correct player controller
    However its a simple player controller and i would not recommand you use it in a real game, its more of a example to help you build your own.

And a few more smaller things, like i said the post above.

The manual is updated to to match the 3.1 version and can be found here :
www.realisticphysics.com/Manual/RealisticWaterPhysicsManual.pdf

The version 3.1 was a in-between patch but as it took a bit more work then expected i did some more side work, but not stuff that was on the to-do list. So i will be working on version 3.2 next what will include a second way of calculating the points, but have it as a option that you can use if you like. That will hopefully stop you losing your settings on each update.

If you experiencing issues let me know here on the forum or contact me trough the website, I added a new message system there so its easier to mail me from there. www.realisticphysics.com
But at the time of typing this message the homepage of the website is currently down, but you can still access everything on it by using the menus

Also don’t forget the rate the asset on the store this helps a lot!
I’m not saying you need to vote it 5/5, a honest review will do a lot better!

2 Likes

Ok so to stop the intire forum post to be filled with my own messages im updating the first post with know issues as we discover them, so if you have a issue please check the first post first see if its a know issue.

Know issues will be fixed before i add more stuff so i always try to fix them as soon as possible might sometimes even be a patch.

Version 3.2 will have the new mesh based buoyancy system added, and it looking good!

Here is a small compare video, on the right is the old point based system, and on the left is the new mesh based system.

As you might see they do behave the same way, but the point system is recommand to be used for smaller or more stable objects, where the mesh based system is good for high quality thats would be impossible with point based buoyancy.

Both systems will have full child support, and both can be linked and unlinked in runtime!

But it still needs a bit of work to get it fully working with all the existing interfaces, But unless i find a big bug somewhere i think i get version 3.2 out next week!

Edit, after some more testing the mesh based system will generate about 5 kb garbage, and a delay of 1.43 ms
While the point based at same quality will have no garbage and a delay of 1.66 ms
And there is not really a way to remove that 3 kb of garbage from the mesh based system, its just the way its calculated.

2 Likes

Im not releasing the mesh based update until i removed the garbage off it.
This will take tome time to work out.

Other news, I created a better drag system for in the water, that will be used for the mesh based system, als will be included in the next update aswell.

1 Like

Can you give a comparison of v2 and v3? Advantages? New features?

Yea sure,

Version 3 is in many way better, i can give you the full change log but its a lot.
To enable and disable support i added buttons to the interface, no more typing the tag is unity editor.
Option to create your own materials trough the interface, no more coding it in the existing list.
The data of the asset is now saved in a stand-alone file, and removed the hidden gameobject that was holding the data for a scene.
Extra checks build inside the interface so that setup mistakes are less likely to happen.
Added water areas so you can have multiple water areas at different heights, the buoyancy will detect it and act correctly based on what its in.
Improved the overall code, giving more access to code side of the asset.
Improved the buoyancy calculations so it will not only take less time to calculate it but also less calculations in total.
Better child support, you can now connect/disconnect other gameobject together in run-time and outside run-time, This works without the use of joints.

And many more things, but thats the few things that are improved compared to the old system.
And version 2 will no longer be updated, version 3 will be and im currently working on a better mesh based buoyancy.

Full change list, from version 2 to version 3 and 3.1:

[Interface]
(^) Updated the realisticBuoyancyScript Inspector UI so it works better.
(+) Added a RealisticBuoyancyChildSupport script with nice interface.
(+) Added interface for creating materials.
(+) Added support interface
(+) Added Auto object check for creating objects.
(^) Updated the interface so it looks prittier :stuck_out_tongue:
(+) Added sort list by alphabetical and density
(+) Added frindly failsafes within the interface,
(+) Added workaround for the failsafes
(+) Added more information in the settings menu.
(+) Added new interface for the buoyancy and water area scripts

[Support]
(^) Improved the way users enable support
(+) Added Suimono support
(+) Added Habrador support (Build in)
(+) Added better river support for Aquas
(+) Added Ultimate Water System to the support list.
(+) Added extra options in the water areas for supported assets
(+) Added extra options to mix more assets together in a single scene.
(+) Added force flow to suimono support.

[Systems]
(+) Added new script to hold the data of the manager.
(-) removed the hidden gameobject that holds the manager
(+) Use of custom scriptable Objects to hold data
(+) Added some code to check if objects are set trough the interface or not, this will fix issues if setup incorrectly.
(+) Added way of creating a object that can float using code, its simple to use 1 liner.
(+) Added uptomaticly upgrading old system scripts to new system.
(+) Added a static script called the RealisticManager to call common code.
(+) Added a RealisticBuoyancyObjectChildSupport script allowing you to link gameobjects together.

[Other]
(+) New child/parent supprot added, called child sub system.
(+) Added water areas, allowing support for multible support enabled at the same time.
(+) Added more information with each option.
(+) Added more user friendly disable blocks on interface.

[Demos]
(+) Include big boat of users.
(+) Boat driving demo
(+) Water Area demo
(+) Script sxample demo
(+) multible objects demo
(+) Added a player scene demo

2 Likes

So small info update for people that are waiting for the new mesh based buoyancy.
Due to Garbage being generated with the mesh based buoyancy i did not release it yet, i completely reworked the system so that i does not generate any garbage during run-time.
It will generate a bit on first setup and a bit when connecting and disconnecting child object(s) due to it having to do the setup again, This is sadly unavoidable because its in unity’s own way of dealing with it.

But i got it to run in the dev build without any, and a good 3.63 Time ms

As you can see the only GC Alloc is from the debug.Log :smile:

It will still be some time before i can release it tough, now that the new system works i need to fine tune it, and make sure the old system is removed without creating to much issues, as for people that update there existing project to the new version there will not be any issue,

The Setup interface will have a extra option so you can setup your gameobject with the mesh based system if you like, the point based system will still be the default.

Other news, im working on something extra to, but im not telling you much more about it till its worked out better.
But the idea works and might be really cool with the Liquid Volume asset, but before you go buy it, i have not tested it fully yet, and i may cut it if i find out it wont work as planned, but might be really cool!

1 Like

small update again, mesh based buoyancy works fine now, really for the next update but it still have issues with drag so adding 1 drag to a rigidbody will fix that but im working on a better drag system now, update is delayed due to that system.

Edit: no the mesh based system still really unstable on high quality or big models, I will put it on the to do list and will work on releasing a version with bug fixes first.

Small,… Well big update coming up…
Because the asset was build around the point based buoyancy adding another system to it is messing with other scripts, this is bit my bad because i never coded it so it can expand, There for im recoding everything again But! This will be a free update not a upgrade like before.

Im also using this time to add some things that where mission in my opinion, like for example the option to use custom materials in the world setup.
I would like to know if you are missing anything, or things you like to be added, you can of course always message me about it, i normally put it on a big to-do-list.

I don’t know a ETA, but this update is worth the wait.

Also if you really cant wait for the update you can message me if you like to try out the developers version of it, might not be working so well or have more bugs but it allows you to peak inside and have your feedback/ maybe ideas be included in the next version!

And if you found a bug in the current version and can’t want for the next version, message me and i will make a patch for you!

Thank you.

2 Likes

The website is fully working again!

http://realisticphysics.com

Hello :slight_smile:

I have 2 questions before purchase:

I’m looking for a solution to have my boat to float dinamically accordingly to the swell of the ocean.

1.Your asset is compatible with “Hydroform Ocean System” asset ?
2.If not, can you please give me an exemple of mesh based ocean asset that work great with your physics system and taking the swell in consideration ? (with waves that look realistic like Hydroform).

Thanks you :slight_smile:
Have a nice day !

P.S. Sorry for my bad english if…

Hey,

Its currently not supporting Hydroform Ocean System, but support is coming for it.
You can get he UWS Ultimate Water System but its expensive, i would recommand you wait till the next update if you can, because that one will include support for the Hydroform Ocean System and also have better support for mesh based buoyancy, currently mesh based bouyancy is not really supported.

Ok thanks you for your fast reply :slight_smile:

In RealisticWaterPhysicsInterfaceWindows.cs I’m getting the following error:

ArgumentException: Getting control 0’s position in a group with only 0 controls when doing Repaint
Aborting
UnityEngine.GUILayoutGroup.GetNext () (at C:/buildslave/unity/build/Modules/IMGUI/LayoutGroup.cs:117)
UnityEngine.GUILayoutUtility.DoGetRect (Single minWidth, Single maxWidth, Single minHeight, Single maxHeight, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[ ] options) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:461)
UnityEngine.GUILayoutUtility.GetRect (Single width, Single height, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[ ] options) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:438)
UnityEngine.GUILayout.Toolbar (Int32 selected, UnityEngine.GUIContent[ ] contents, UnityEngine.GUIStyle style, ToolbarButtonSize buttonSize, UnityEngine.GUILayoutOption[ ] options) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:214)
UnityEngine.GUILayout.Toolbar (Int32 selected, UnityEngine.GUIContent[ ] contents, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[ ] options) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:161)
UnityEngine.GUILayout.Toolbar (Int32 selected, System.String[ ] texts, UnityEngine.GUILayoutOption[ ] options) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:147)
RealisticPhysics.RealisticWaterPhysics.RealisticWaterPhysicsInterfaceWindow.OnGUI () (at Assets/RealisticPhysics/RealisticWaterPhysics/Editor/RealisticWaterPhysicsInterfaceWindow.cs:2405)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[ ] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:291)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:284)
UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:251)

If I have the manager window open and I’m playing my game.

Also I’m using Unity 2018.1.2