# How to choose the next point closest to the current position from the curve consisting of points？

## Recommended Posts

array of points(green dot) connected into a curve line,It was just nothing more than array of points arranged in order , order of insertion.

As shown in the above figure, my goal is for the player to start from "S" and choose a point that is closest to the player and is naturally reasonable(i mean i can't walk through the wall).

X
by BWPlayer

X
by BWPlayer

X
by BWPlayer

X
by BWPlayer

But because the shortest distance between the two points is W, it suddenly move through to the other side, which is definitely not what we want.actually what i desire is "N".

Of course, i have used cross-production to determine if the point being chosen is relative to the left-side or right-side of my current location.with points on the right-side of my position has been chosen as candidates,then pick one of them, which is minimum distance compared with others.

Edited by qxsl2000

##### Share on other sites

Sorry that no one has answered, but it is perhaps because your question is really not worded well at all... plus there seem to be missing images?

##### Share on other sites

Yeah, it's kind of unclear what's the question. But maybe you want to take a look at this: https://www.cs.cmu.edu/~kmcrane/Projects/HeatMethod/paper.pdf

It's meant as a very accurate approximation of geodesic distance on surfaces, but it works on volumes or graphs of points too.

(Assuming you already ruled out Dijkstra and A* for some reasons? The above can be used in a real time scenario eventually if you use iterative solvers with one iteration per frame.)

## Create an account

Register a new account

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 11
• 22
• 36
• 9
• 16