How to create a grid of points on a complex mesh

I have a mesh and i want to generate a list of Points on a mesh so that all points are placed on the surface of the mesh or very close to it,
At the same time, the points should be at distance (X) from each other and this distance can be in range like ( X < 1 && X > 0.9f)
These points will be used within an algorithm to find the shortest distance later to move objects on the mesh surface

something like this:

Voxelization is your friend.

If needed, you can take the resulting surface voxels and project them to the closest point in the mesh. This allows you to get them as close as you need to the actual geometry and orient them properly using mesh normals.

2 Likes

If you have a mesh then you want subdivision.

There are many strategies for subdivision, each producing different results.

If your mesh is irregularly spaced and you want regular spacing, you may need to remesh it as well, either before or possibly after subdividing it.

Once you subdivide it you may even want to decimate it to fix it further.

None of these functions are available in Unity.

All of these functions are present in most 3D packages, such as Blender3D, and various algorithms for doing it can be found in various forms on the interwebs.

1 Like

Seems like a good idea to start with thank you!

the mesh will be created processually during the game, so I need a solution inside Unity, thank you!

@Michelle_Ca Hey, have you found solution?