- Home /
How do I measure the distance between two points on a mesh?
I realize this sounds more or less like A* pathfinding and if that's the only solution than that will be acceptable, but if there is a simpler or quicker way, that would be great.
I have several different irregular convex meshes that I'm using for energy shields. My game uses 6 shield facings but I'd like to avoid using separate meshes as that would take a ton of time to generate for each individual ship. Instead, my idea is to measure the distance along the shield surface from the hit location to the shield generators and determine which shield generator is closest. Obviously, with complex ship shapes, measuring the straight line distance between the points would not always be the most logical.
TL;DR: Is there an easy and cheap (in terms of processor time) method for finding the shortest distance between two points along an irregular surface?
I guess you can pick a direction toward a vertex on u your mesh and calculate that distance as well as the distance between the picked vertex and the target point. Then do this for all the vertices that are closest to you starting point and the pick a point that is shortest. $$anonymous$$eep doing this until you reach the target.
Also take a look at euclidian shortest path
Your answer
Follow this Question
Related Questions
A* Pathfinding- A moving target 1 Answer
CalculatePath often returns wrong results 0 Answers
Why don't my enemies walk toward me? 1 Answer
Path finding freezes Unity 2 Answers
Navigation Mesh not working in build 0 Answers