Buoyancy - simulating disturbed medium (waves)?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Buoyancy - simulating disturbed medium (waves)?

Postby misho » Thu Apr 25, 2019 2:54 pm

Hi everyone!

I am working on the last piece of functionality for my spaceflight simulator: Capsule splashdown! I am using demoSandBox's Archimedes Buoyancy example as a starting point. I created my own compound collision shape that roughly approximates capsule shape, gave it realistic weight and kind of played around with density, and things look great so far.

My question is, after the body settles in the water, it is completely still. I would like it to have some "bobbing" in the water, due to the constant motion of water in open ocean. How can I accomplish that? Can I just move the "water box" that the capsule is in, and create viscous forces on the capsule, thus causing it to "bob"?
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Buoyancy - simulating disturbed medium (waves)?

Postby Julio Jerez » Thu Apr 25, 2019 3:07 pm

you will have to make some procedural way to make a ocean waves animation that generate the position and surface normal of the fundamental harmonic of the crest of a wave at the location where the center of mass of the body is, them pass that animated plane to function
dFloat volume = NewtonConvexCollisionCalculateBuoyancyVolume (collision, &matrix[0][0], &m_plane[0], &cenyterOfPreasure[0]);

a simple sin wave that generate two or tree harmonics will do it in a 2d plane,
look that up people do that all the time to animate waves in games.
In this case is much simple because you only need the high and normal at the point where the capsule it.
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Buoyancy - simulating disturbed medium (waves)?

Postby misho » Thu Apr 25, 2019 3:19 pm

Great! Actually, my case is much simpler, as my ocean has a 2-d surface with animated wave textures... so, there is nothing that visually looks like a 3D wave that would interact with capsule body (although, that would be fun to re-create as well). All I need to do is move the capsule in some way to suggest it is not completely still in the middle of the ocean...
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Buoyancy - simulating disturbed medium (waves)?

Postby Julio Jerez » Thu Apr 25, 2019 3:29 pm

I do not understand what you mean moving the capasule, that will be wrong.
I hope you mean moving the buoyancy plane.
It comes all down to animating the buoyancy plane by whatever means you'd decide.
The same way you say move the capsule, apply that motion to the buoyancy planeinstead.
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Buoyancy - simulating disturbed medium (waves)?

Postby misho » Thu Apr 25, 2019 3:49 pm

Julio Jerez wrote:I do not understand what you mean moving the capasule, that will be wrong.
I hope you mean moving the buoyancy plane.
It comes all down to animating the buoyancy plane by whatever means you'd decide.
The same way you say move the capsule, apply that motion to the buoyancy planeinstead.


YES - that's exactly what I meant:

Can I just move the "water box" that the capsule is in, and create viscous forces on the capsule, thus causing it to "bob"?


"water box" in this case is what I meant by buoyancy plane... So - I was correct, I can just "shake" the buoyancy plane by perhaps giving it a bit of a sine displacement function in up-down and forward-backward direction!
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Buoyancy - simulating disturbed medium (waves)?

Postby Julio Jerez » Thu Apr 25, 2019 3:53 pm

Late tonight I will add a 2d stationary wave, to simulate the motion of the water, them you can just take that piece of code and added to your project and that capsule will bob up and down naturally.
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Buoyancy - simulating disturbed medium (waves)?

Postby misho » Thu Apr 25, 2019 4:09 pm

Julio Jerez wrote:Late tonight I will add a 2d stationary wave, to simulate the motion of the water, them you can just take that piece of code and added to your project and that capsule will bob up and down naturally.


Excellent - thank you!! I will also have to orient the buoyancy plane to be tangent to the location on Earth that I am in, since my "world" is a true size 3D Earth.

BTW, I have everything else working - The re-entry (with plasma and glowing heat shield) and the capsule shaking (with the scared astronauts inside :mrgreen: ), multiple parachute sequences, and hopefully soon, the proper splashdown! I will post a video when all of it comes together!!
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Buoyancy - simulating disturbed medium (waves)?

Postby Julio Jerez » Thu Apr 25, 2019 5:16 pm

if you sync they is a skeleton of the plane, Is no calibrated, will nee to add some debug info to show when the plane actually is, and no is no doin the normal alignment,

I will do the rest later tonight by you can see how to get a stationary 2d wave with three sub harmonic.
this is like a Fourier transform of some shape.
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Buoyancy - simulating disturbed medium (waves)?

Postby misho » Thu Apr 25, 2019 6:07 pm

Great, I'll check it out ASAP!!

BTW - I would need movement in 2 directions, Up-down for wave crest-trough, and back-forward for horizontal wave travel direction.
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Buoyancy - simulating disturbed medium (waves)?

Postby Julio Jerez » Thu Apr 25, 2019 6:38 pm

no, and I do not want to start another can of worm again, but waves in the ocean do not move horizontally, they only move up and down. this is what is call stationary waves.
move wave is called shallow water fluid dynamics.

what happens is that as they move up, the crest has a slope, and what even is floating there will slide down. this is what is call surf, but it has to be tide in very precisely to surf for a long time.

in you case you will have to make there wave period very long as they are in the ocean, and also align the plane normal to be perpendicular to the wave surface.
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Buoyancy - simulating disturbed medium (waves)?

Postby misho » Thu Apr 25, 2019 7:00 pm

Julio Jerez wrote:no, and I do not want to start another can of worm again, but waves in the ocean do not move horizontally, they only move up and down. this is what is call stationary waves.
move wave is called shallow water fluid dynamics.

what happens is that as they move up, the crest has a slope, and what even is floating there will slide down. this is what is call surf, but it has to be tide in very precisely to surf for a long time.

in you case you will have to make there wave period very long as they are in the ocean, and also align the plane normal to be perpendicular to the wave surface.


Ok, no worries. All I wanted to re-create is back and forth motion as well, so that the capsule is hard to dock to when crew retrieval boat arrives (or capture with a helicopter winch) . I know some of my users will insist on this aspect :mrgreen:

Keeping the lid on can of worms - I'm a diver, and countless of times I have seen sea weed moving back and forth due to the wave surge (carrying me along as well), and this was at a considerable depth... So - isn't there some horizontal wave momentum as well, that gets less prominent with depth?
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Buoyancy - simulating disturbed medium (waves)?

Postby Julio Jerez » Thu Apr 25, 2019 7:30 pm

On the boundaries, there is fliud displacement, this is why shallow water has currents, its because the fluid bounce of the obstacles,
There are also currents, but none of that has to do with waves generated because of the fluid weight.
And we are not making a fluid simulation, only a fake visualisation of deep water waves that can be represented with low frequency Furier expansion.
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Buoyancy - simulating disturbed medium (waves)?

Postby misho » Thu Apr 25, 2019 7:53 pm

Ok, sounds great!

Another thing I wanted to ask - when I test my capsule in demoSandBox... I have it dropping into water from a small height, about 5 meters. When it dunks into water, its buoyancy forces it out and it completely leaves the water (upwards) at quite a height, and this repeats until it settles down.

In real life, I suppose there would be some water resistance on the object getting out of the water, and the capsule would never jump back out of the water (at least, that high).. So how do I adjust that in Newton? With water viscosity?
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Re: Buoyancy - simulating disturbed medium (waves)?

Postby Julio Jerez » Thu Apr 25, 2019 8:23 pm

add more drag.
Julio Jerez
Moderator
Moderator
 
Posts: 10954
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Buoyancy - simulating disturbed medium (waves)?

Postby misho » Fri Apr 26, 2019 12:07 am

Great, that works nicely!

Only a little was needed, and a bit less than what was there:

Code: Select all
//             const dFloat viscousDrag = 0.997f;
               const dFloat viscousDrag = 0.985f;
misho
 
Posts: 525
Joined: Tue May 04, 2010 10:13 am

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron