How to find shortest path between vertices?

Hi,
I’m trying to find shortest path between two vertices marked by the user using dijkstra algorithm and show that path on the “character”. You can see my main goal in the image.

So far I’ve managed to put blue and red balls on the “character” and get the corresponding vertices. I put all the vertices in a Vector3 List using:
playerMesh = playerMeshCollider.sharedMesh;
playerMesh.GetVertices(playerVerticesVectorList);

So I can access to positions of vertices . But the problem is I can not figure out how to find which one is directly connected to which one. How can I do that?

Hi, to get the underlaying structure of the mesh from the vertices you’ll have to make some kind of data structure that store that relation. In your case, what I suggest it’s that in your pathfinding algorithm do something like this:

class VertexNode {
        public Vector3 position; //or int index or whatever you are using
        //...other relevant data
       public List<VertexNode> neighbours; //here you store the connected vertices
    }

And whenever you take a vertex to explore it you create this VertexNode class and check for the neighbours. I guess that to know the vertices connections you’ll have to access the mesh faces. You
see in what faces appear that vertex and add to your neighbours the other vertices of that face.

Hey, did you find the solution?
How did you get the neighbours?
@unity_WPzfLehdpNGaDQ