🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

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

Started by
2 comments, last by JoeJ 5 years, 7 months ago

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.

 

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?

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

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

This topic is closed to new replies.

Advertisement