Runtime GameObject Manipulation (Boolean Subtract or something similar)

Hello, I am working on a 3D project where a process diagram is requested at runtime and visualized as system of rivers and ponds representing events, tasks, flows, etc. At the moment it is represented by some flat GameObjects laying on a plane which are instantiated via code.

Now I am searching for a solution that a boat could drive on this river, using collision physics with the edges of the rivers and ponds.

Immediately I thought of boolean operations, where I could cut out my river parts out of the ground (at runtime) and fill the remaining holes with water. I quickly found some answers that this problem is pretty hard to solve and that there seem to be no existing assets or libraries solving this.

Another way could be to somehow put only colliders at the edges of the whole river system, so that the boat can’t escape the water and collides with the boundaries. But I find it really hard to think of a way to assemble the diagram with those kind of borders without flaws. The boat can sink into the ground with wisely chosen colliders, i dont need water for that, but the edge collision part is where I struggle.

The critical points are:

  • the building of the river system happens at runtime
  • the process diagrams can have any form or arrangement
  • I want the boat to stay inside the river elements

Does someone have an idea how to solve this?

If you limit the types of connections you have, you can pre-generate prefabs with correct colliders depending on its connections. For example, a square area in the river could have 3 paths pointing out from the top, bottom and right, so you pick a prefab from your dictionary matching those categories. This might take you a while to get all the prefabs, but you could automate it if you see patterns.


My second option would have been to look into something like voxel terrain and each shape would fill in some data on a grid. This grid can then be generated into a mesh using the naive/greedy meshing algorithm (like minecraft), which would generate blocky terrain, or marching cubes, for smoother edges.

Thanks for the reply! :slight_smile:
I also thought about the first option being a pretty time consuming approach, but if it was my last chance I would try this.
Your second option seems pretty interesting to me, although I have never done anything like it. I think I will try that one first, because it would probably be visually more impressive.