Jump to content

Oil Platform Sample and Water Physics


Recommended Posts

Posted (edited)

Hello everyone !

I was reviewing options for water-based simulation inside Unigine and I looked at the Unigine script samples and the oil platforms, which featured floating boats.
I had a few questions.

1) In Unigine Editor, the sample Oil Platform's physics engine returns an error and all the boats fall through the water, if I enable physical simulation. Is it not compatible with Unigine 2.18.1 ? In play mode it works, but it's a little annoying to have to go back and forth from the C++ based project and the play interface...

2) While Unigine has water meshes and water bodies, as demonstrated by the samples, you use none of those in the oil platform sample, and you choose to manually implement physical properties for floating objects (in Unigine script !). Why is that ? Does that mean it's preferable not to use water meshes/bodies for boats or use case such as the oil platform ?

3) My targeted use case is very similar to the oil platform sample, with boats<->wave interaction being of paramount importance.. If I were to use Unigine to simulate my boat, should I follow the same ideas as your use of water bodies and meshes, or can I make A c++ implementation of what you showcased in the oil platform sample (while it works, I haven't completely investigated the clarity of the code or its robustness).

Thanks in advance

Edit: I did see this post 

But I was still a little confused about what Unigine could and could not handle in water physics

Edited by K.Wagrez
Posted

Hi Kevin,

1) UnigineScript logic is being disabled in Editor because the ships are always swimming away and when artists are trying to modify the sample they always appear in some random places :) And since there are also some particles attached to ships, their states also being saved alongside with the world, which results in additional work later to revert these changes. You can modify and remove this logic if you don't need it.

2) Physical water is a separate object which is quite small and could not be really used in global water scenarios. Yes, it's fun when you can drop some crate on a water surface and it will produce wakes and will automatically float, but that's not really working when you need to simulate several hundreds km of water surface. Also there is no good way to handle different Beaufort levels. So GlobalWater + custom logic in that case works pretty fast and produce some good visuals. If you want your ship to behave "more physically correct" you can check our new sample where some additional volumes under the boat are taken in account: https://github.com/unigine-engine/cpp-api-samples/tree/main/source/nodes/water_physical_buoyancy:
image.png

3) You can use either a simple oil platform logic or extended new from the updated samples. Maybe even simple one would be enough for your use-case :)

Thanks!

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

Indeed, your new samples are very interesting (and implemented in C++ !), and I just found about the documentation which is actually pretty clear (Unigine Developer).

So yeah WaterGlobal and some custom physics code it is. This seem like a good base for our use case. I will come back if I require more details based :).

I haven't yet looked precisely in the code, but how difficult you think that would be to control the water's beaufort level so as to have only a part of the sea with high beaufort (or some gradient of beauforts) ? If we wanted to make just One big wave ?

Posted
Quote

I haven't yet looked precisely in the code, but how difficult you think that would be to control the water's beaufort level so as to have only a part of the sea with high beaufort (or some gradient of beauforts) ? If we wanted to make just One big wave ?

Do you want to make a local storm somewhere in the ocean and near the shoreline you want waves to be smaller? Or what is the use-case?

ObjectWaterGlobal can only have a single Beaufort level at a time. This effectively means that you can still define multiple areas (coordinates) with different Beaufort levels and write an additional logic for Beaufort level interpolation based on the current camera position. When camera moves from one point to another you can seamlessly blend between pre-defined Beaufort levels and you can sail from 0 to the storm seamlessly. Also if you will do the quick teleport from the shoreline to the middle of the ocean, the water level will raise immediately, causing the ships to be underwater for quite some time :)

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

×
×
  • Create New...