Pathfinding Project and Building Navigation

Hello Aron, hello fellow community!

I’ve got a school project - navigation within building, using augmented reality markers. I want to use A* Pathfinding for finding the correct route from starting point to the destination. Markers are mapped to the graph nodes. The idea is to {calculate path each time a marker is visible and then display an arrow pointing to the next node.} until startNode =/= destinationNode

.

This is the model I’ve created. I’ve got 5 point graphs at different Y levels. My questions are:

  1. How do I get next node of the currently calculated route?
  2. How do I call “calculatePath” properly?
  3. The building has 6 elevators and 4 staircases - can I create one 3D point graph to find routes or should I do 5 flat point graps (the ones like in point graph example scene) and then handle “teleportations” among Y level separately?

Hi

  1. “next node” is a bit vaguely defined, but for this use case I would expect that you would recalculate the path relatively often, and then you can usually just point to the second node in the path like this

    void OnPathComplete(Path p) {
    var pointToDrawAnArrowTo = p.vectorPath[Mathf.Min(1, p.vectorPath.Count-1)];
    }

See the GetStarted guide for information about how to get the OnPathComplete method to run.
Or this page: http://arongranberg.com/astar/docs/calling-pathfinding.php

  1. I would suggest a single point graph. You will have to be a bit careful though because if on some floor the nodes are spaced very far apart, the scripts might find that a node on another floor is closer to the character’s position than the closest node on the current floor.

Aron,

First of all, thank you for your reply and forgive me the delay in answering further about how this worked. I’m glad that you didn’t leave the question unanswered, it might prove useful to someone trying to solve similar problem.

Secondly, I solved the navigation app by writing my own implementation of Dijkstra’s algorithm and using database with all connections between the nodes. The reason I was considering using pathfinding project was a workaround for creating mentioned database (a lot of work with the data).

I’m still curious though, would the app, based on this workaround work better and faster with A* Pathfinding than natively implemented Dijkstra? This question shall remain unanswered, since the navigation app was eventually a success.

Hi

I’m glad that you managed to solve it.

Using A* would be faster than using Dijkstra. However if pathfinding performance was not an issue (looking at the screenshot above, it doesn’t look like there are that many nodes) then it doesn’t really matter.