Make a Part Oscillate While Floating in Water

Floating

In the gif above, you can see a part given Density 0.2 via CustomPhysicsProperties. This causes the object to float on water as expected, but in addition to that I’d like the object to oscillate up and down with the waves. It can stay in the same place (it doesn’t need to get swept away by the current).

My goal is to create a buoy that appears to be floating in the ocean, like the below gifs:

GIF-GBP1800

216e438caac38f850d6429b6b7b8616e_w200

4 Likes

The waves are just a visual effect and do not affect anything, so its impossible to precisely move the buoy up and down. The best thing you can do is to animate it going up and down, in most cases it looks good enough if you match the timing of the waves.

1 Like

Is it possible to tie into the shader or whatever Roblox is doing to generate that visual effect via a script. For example something like “terrain.GetWaveHeight(x, z)”?

2 Likes

No, as far as I know there is no way to get the information about the waves.

There is this: Sampling Terrain Water Height at Any Position

However it isn’t accurate when you stray away from 0,0,0 and falls out of sync after a while. It is better than nothing, but you’ll have to try and account for any inconsistencies which is difficult.