I am making a game in Unity3d and I need a pathfinding algorithm that can guide enemies towards the player on a 3d surface. The problem is that the 3d surface can take any shape, so it can be a 3d sphere, cube, torus and many more shapes.I tried using A* but for that formula I need the distance between the two points, and since the object is curved I cannot get that so easily. I found that you can use the Haversine formula if its a sphere, but that won't work on a torus or a random 3d shape.I want this kind of result except with every kind of object: https://www.youtube.com/watch?v=hvunNq7yVcUIs there a way/algorithm that I can use to get that result? I know there is somthing called nav mesh but I need to program it myself. Also I cannot find how nav mesh approaches this dilemma. I am going to use the triangles of my object as nodes.So my question boils down to:Does anyone know a algorithm for pathfinding that works on any 3d surface?Thanks in advance.
Find the distance between two points on any 3d surface
algorithms