Custom Medium Physics (Open Source)

This is impressive, well done. I especially like the physically simulated waves, even if they’re just sine waves for now.

When you do open source this it will be a huge help for me and a whole lot of people. I currently still rely on terrain water for large oceans and it looks nice and has good physics but the resource usage is ridiculous.

3 Likes

Yeah, it is definitely not made for low-end computers. I can probably implement Gerstner waves at some point.

Tip: try the sail boat instead of the motor boat if you want to see the physics in action. The wind direction is paralel to the waves direction (yes you actually have to ‘sail’ your way forward).

I would love to have this open-sourced, been searching for a solution for client and server sync & float physics and couldnt find it anywhere. This looks amazing!

1 Like

It is actually more than buoyancy. Have you tried the sail boat? You can actually sail like you can irl.

1 Like

I have, its really cool. I really love it honestly, cant wait to (if open-sourced) use it!

2 Likes

Quick question! Do the boats have weight values to make it not too floaty on the water to point of no control?

I estimated the submerged ratio, which I use for determining the density of the medium. This way, you can smoothly transpose between water and air.

1 Like

I open sourced the project, so you can take a look if you want.

Hello!

I want to start off by saying that this resource is a godsend and has been a massive help to my projects.

I have run into an issue and it’s proving to be a bit of a pain in the back.
I have noticed that the further away from the center of the world you are, the less consistent and refined the waves are. Basically, they look more “jagged” the further you go out.

(At spawn)

image

(Far away from spawn)

It’s worth noting that I have performed some modifications to the source code, ie; changing values to make a less dramatic water. I have also removed all of the physics related kit that comes installed so that it is very much just the skinned mesh water. However, the problem is consistent with the original.

Would you be able to help me solve this problem?

1 Like

I’m not sure if you have another post about this in #resources:community-resources, but since it’s open source, wouldn’t this belong there?

Yeah, probably. I did not open source it initially, which is the reason why it is here.

1 Like

I am aware of that. Chunks that have a different level of detail do not overlap perfectly, which causes them to look jagged at times.

I later found out that you can scale MeshParts past 2048 studs. This means that as a solution, you can make a circlular skinned mesh with a high level of detail in the center and a lower one towards the border. Then you can update the bones like the current system does. This way, you get rid of the chunks and therefore the jagged-looking effect.

So basically the solution is:

  1. Make a circular skinned mesh with a high resolution in the middle that lowers towards the border (for performance)
  2. Load it into Roblox Studio
  3. You can use the same script (and modify it), since it is made to work with any skinned mesh
  4. Adjust the script to displace the bones further away from the center (in order to scale the mesh past the 2048 studs limit)

EDIT: I found out that textures deform depending on the triangle size that they are rendered on. So having a mesh that consists of triangles of different sizes will result in visibly altered textures. Therefore, I recommend to copy the methods that are used to make this sea instead if you want to go for great aesthetics.

1 Like

Can you send me the place file? I’m trying to edit the place but I can’t. I’m having a hard time figuring out the size of the wave from where the player is

The place file would very much so be appreciated, as @marcosOP007 mentioned.

Can’t seem to edit from the game page.

1 Like

I included it in the topic before ‘References’.

2 Likes

It is open sources!

Place file:
CustomMediumPhysics.rbxl (111.5 KB)

Hello again!

I’ve been experimenting around with the look of the ocean to try and make it feel more “oceany”. I recently discovered that it’s possible to add texture scrolling to skinned meshes and I have been hellbent on trying to figure it out. I have so far only managed to get it working in one plane.

After much poking around I can’t find anywhere to implement this and given my general lack of knowledge on code in general, I don’t know how to add a separate script to handle it for me.

-- ("texture" is just a placeholder variable for a texture in the plane)

for X = 1, 3000 do
		wait()
		texture.StudsPerTileU += 1
		texture.StudsPerTileV += 1
end

I want to run this simple UVoffset scrolling loop in every chunk model. How and where do you think I could best implement this?

Desired effect (replicated on alternate water):

2 Likes

I’m really sorry for bumping this, but I just can’t find a way to add physics to my own objects. They are just objects, not actual boats, like trash and stuff

I believe that I used tagging from the CollectionService in order to bind my physics component to my objects. I’m pretty sure that the component in this project is made for individual objects like Parts, rather than entire boats at once.

If you decide to use this component, then please bear in mind that it might be a bit old and its quality is not production-grade.