Jump to content
  • Advertisement
Sign in to follow this  
qxsl2000

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

Recommended Posts

question1.png.fa7636090af9638ca72e44dabe6db8e8.png

                         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".

any hints on this,look forward to your reply,thank you.

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
add tags

Share this post


Link to post
Share on other sites
Advertisement

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 this post


Link to post
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.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!