I have a game which uses a touch event to move trucks to a station though a array of vectors. The main problem is when you want to park a truck into the station, the station will have only 1 way in so if you drag to the "this point" i want to be able to work out how far each way around to the enterance it is and pick the shorest way in.
Any help in achiving this?
Thanks in advance
asked Jul 20 '10 at 06:31 PM
I can only make some assumptions and hope that they are correct...
"move trucks to a station through an array of vectors" - you have some kind of nodes and edges your trucks can drive between (streets and street corners)? And your truck is at one node, while the station is at another node?
If thats what you mean, than you may want to take a look at http://en.wikipedia.org/wiki/Shortest_path_problem. Some of the algorithms named there are also to be found as ready-to-use scripts in the unifycommunity, but they are probably overpowered for your problem (they are more thought for things like NPC movement without restriction to streets like your trucks).
answered Jul 20 '10 at 09:09 PM