Page 1 of 1

GPS Navigation Directions? (3D)

Posted: Mon Jan 19, 2015 3:29 pm
by vitinho444
Hey guys,
today I've come with a sort of "problem". Do you know those A* pathfindings? Yeah they work pretty well, but how can you make a GPS Navigation in a game (3d) from point A and B?

My "programmer brain" tried a bit, and came to the hypothesis of a hashmap with keys being the origin and destination, then there would be every single possibility of paths from every waypoints.

Imagine the following: you have a house with a corridor (you are on the corridor), and you have 4 rooms, 2 in each corridor side. If you want to go to the furthest room it will check that hashmap with the current position you are (or the last checkpoint) and see where it matches the furthest room waypoint, and enable the "direction path" objects on the way...
Is this any good? How would you do it?

Re: GPS Navigation Directions? (3D)

Posted: Mon Jan 19, 2015 11:32 pm
by Jackolantern
It depends on what you mean by 3D. If your characters are floating through the air and can actually move in any direction, that will be a bit tougher but I bet someone out there has tackled it before. If your characters are under the effect of gravity and can't just decide to go straight up into the air, then the typical A* will work fine. You just divide the ground in your game into a 2D array, mark which ones cannot be traversed through (walls, fences, etc.) and then run that through the A* algorithm. It won't matter if they are going up hills, or walking along raised blocks, or anything like that since they are still at a location in the 2D array. If there are multiple levels of height, such as different stories in a building or tunnels underground, just use the current level that the player is on as the ground to divide up into the 2D array.

Re: GPS Navigation Directions? (3D)

Posted: Tue Jan 20, 2015 12:18 pm
by vitinho444
So the answer might be to look at this problem in a 2D prespective?

I can see it, but I'm afraid this would be a pain in the butt to "re-invent" :/

Re: GPS Navigation Directions? (3D)

Posted: Tue Jan 20, 2015 10:56 pm
by Jackolantern
What are you using? I would assume since this is 3D you are using some kind of engine, and from your previous posts I would guess Unity, right? Do they not have a solution for this built-in? That would surprise me.

Re: GPS Navigation Directions? (3D)

Posted: Fri Feb 06, 2015 9:25 pm
by vitinho444
(Again, I'm sorry for the delay on the reply -.- Don't know why the "See Latest posts" link didn't include your reply.. )

I am using Unity yes, and I don't think it has a 3d navigation system built in... At least that I know of. What I did was to create a 3D arrow and do the navigation with it. Like this:
Image

Image

It's a little rudimental, but I guess it's fine for the purpose...