I have the following mesh, it has very simple structure. You can think of it as a terrain from top-down view: each vertex (red and numbered) is a fixed distance away from its four neighbours in the horizontal
xz plane (e.g 1 unit); only
y (height) is different.
How could I get the vertices affected by a given overlaid shape?
By "Affected" I mean vertices that are inside or on the border of the shape, and any vertices that share a triangle with them.
Here I've drawn a pink rectangle on my mesh, and circled in green the vertices that should be considered "affected" by that shape.
- The constant distance between vertices
- The center of the mesh as a Vector3 (mesh is a square)
- The mesh's width/height (any corner could be calculated easily)
Some context, for what?
- Flatten terrain on when building a structure, road, etc
- Edit terrain with a brush (circle and other brushes)
- Vertex/texture painting, etc