
I'm trying to create some sort of grid space for different kinds of ground meshes (just like in the picture). I won't need this grid for movement, it's just for instantiating objects before the game starts. These objects (representing the grid cells) will have their own properties (colliders, info, etc.), and will mostly be used for other objects placement on the grid (by the user).
I need to find a way to get the center of any quad formed by two half-square triangles, and pass that to the instantiate method for the position.
The ground meshes will always be modelled in respect of the unit size (eg., the quad); I just need a way to make the instantiating phase an automatic procedure (mabe done via Editor script), to prepare the game levels.
I've tried different approaches; for example, I came up with (working) code that given a triangle in a mesh, it finds its opposite (meaning, the one that creates a quad with it). The problem is that this code is based on RaycastHit.hitTriangleIndex; now I need a more generic procedure to process the ground mesh and find ALL complementary triangles which create a quad, in an automatic way, withouth raycasting input.