x


Shorest distance around a gameobject

http://skitch.com/mpollard/dpcf1/skitched-20100720-183004

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

more ▼

asked Jul 20 '10 at 06:31 PM

mark 1 gravatar image

mark 1
37 6 6 8

Without knowing more about what the world looks like and what kind of pathfinding system you're using, we probably can't help you.

Jul 20 '10 at 06:37 PM qJake
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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

more ▼

answered Jul 20 '10 at 09:09 PM

felix. gravatar image

felix.
2k 18 25 47

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2173
x373
x5

asked: Jul 20 '10 at 06:31 PM

Seen: 616 times

Last Updated: Jul 20 '10 at 06:31 PM