Amerio.Stephane Posted November 29, 2017 Share Posted November 29, 2017 Hello, I've been trying to understand how water/rigid bodies interaction are to be set up, but even though I had a deep look at the physics samples in Editor 1, I could not reproduce any of them in the Editor 2. Surely, I must be missing some crucial steps but I don't know where to look. Here is the step-by-step way I tried: 1-Start Editor 2 with a new default scene. 2-Creating the water: -Create Primitive Plane with 40x40m and 40subdisision. -Create Mesh from it and remove the node. -Then Create Object/Water Mesh with the water mesh just saved. And I move it up a bit to somewhere like (x,y,z)=(0,0,3) -Finally assign a "Water" body type to it [Note: at this step, the shading goes all wrong, with very tiny ripples on the water. Is this correct?] 3-Creating a buoy: -Create Primitive Box, and I move it up a bit, like (0,0,4) -Assign a "Rigid" boy type to it -Assign a Box shape to it, and tweak the mass to 0.01 so it's way less dense than the water Now, at this point, I would expect the box to be floating. But it simply goes to down to the default ground :( I played with the water Interaction, the water density, etc, to no avail. What did I miss ? Thanks Link to comment
silent Posted December 5, 2017 Share Posted December 5, 2017 Hi Amerio, What kind of water interaction are you looking for? Depending on it implelentation can be very different (performance also can vary). As you may already notice, that demos are not only consists of .world file, they also have some scripting logic (as for the physics/water_01 example). We also have a Oil Platform demo where you can take a look into the C++ / UnigineScript code that calculates the boat position on water based on 3 points. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Amerio.Stephane Posted December 5, 2017 Author Share Posted December 5, 2017 Hello, My end goal is to have a buoy that would freely move vertically and rotate according to the see waves, but would roughly stay in the same place (like a real anchored buoy). In a first step, I tried to just create a free-to-move buoy. I couldn't understand if this can only be done through code or if it can be done in-Editor. Link to comment
alexander Posted December 5, 2017 Share Posted December 5, 2017 Hi, Amerio! What did I miss ? 2-Creating the water: ... - Set "Collider object" flag to Enabled state. This is necessary to enable collision detection with other objects (it looks like a bug. In theory, it should be enabled by default). - Set "Depth" field of the Body to some value (6.5 for example). - Set "Density" to 16.0, for example.That's all. Now every physics object should float. I think, the following values look pretty good: Depth: 6.5 Density: 16 Liquidity: 0.25 Linear Damping: 16 Angular Damping: 16 Interaction: 2But, I strongly recommend to use the approximate mathematical methods to simulate interaction with water, especially if you have huge areas with a lot of details. Unfortunately, this can be done through code only. Best regards, Alexander Link to comment
oleg.ferapontov Posted April 20, 2020 Share Posted April 20, 2020 On 12/5/2017 at 1:19 PM, alexander said: But, I strongly recommend to use the approximate mathematical methods to simulate interaction with water, especially if you have huge areas with a lot of details. Unfortunately, this can be done through code only. Best regards, Alexander Hello! Since this topic is connected to question I have - I want to ask it here, if you allowe it. So, we have a global water, to create a good physics for boat I need to appy forces to number of places on it's hull, for this purpose I also need get height value of water in world position, is it possible to do? Maybe you can mention C++ method for this? Link to comment
silent Posted April 20, 2020 Share Posted April 20, 2020 Yeah, you can use getHeight() from ObjectWaterGlobal for that: https://developer.unigine.com/en/docs/2.11/api/library/objects/class.objectwaterglobal?rlang=cpp#getHeight_Vec3_float How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
oleg.ferapontov Posted April 20, 2020 Share Posted April 20, 2020 1 hour ago, silent said: Yeah, you can use getHeight() from ObjectWaterGlobal for that: https://developer.unigine.com/en/docs/2.11/api/library/objects/class.objectwaterglobal?rlang=cpp#getHeight_Vec3_float Perfect, thank you! Link to comment
Recommended Posts