1

I am using A* algorithm to find the shortest path between a box and a movable character in a navmesh graph. The box is meant to follow the character.enter image description here

If the character is behind an obstacle or room(for example), then box would travel via the shortest distance, which as shown in figure. Is there a way to prevent the box form moving through this path and walk around the room.

Since I have to avoid moving back while finding path between points, any entry in closed list is first checked to see whether it had already been there. Say you reached a corner, then all the meshes that can lead you back out of the corner are all already present in the closed list and you gets stuck there as a dead end. This case can be seen if the room in the picture below is considered of small width. This problem could have been removed if box didn`t move inside the room to begin with.

Can ray tracing or steering be used? Found this question but the answer wasn`t clear. A* for finding shortest path and avoiding lines as obstacles

Community
  • 1
  • 1
user3124361
  • 471
  • 5
  • 21
  • 1
    If you are using A*, the path to the character should be found eventually (probably after exploring the room and then backtracking). Is that failing? Or are you asking if there's an optimization to avoid exploring the room at all? – erickson Jan 20 '15 at 17:13
  • yeah, I was asking about the optimization to avoid exploring the room – user3124361 Jan 20 '15 at 17:15
  • Or, I want to avoid backtracking – user3124361 Jan 20 '15 at 17:28
  • Your question is a little unclear. There's a difference between "the box goes into the room" and "A* considers paths that go into the room". You'll have the first problem only if you **aren't** using A* to find the correct path. – user3386109 Jan 20 '15 at 18:33
  • sorry that I couldn`t make it clear enough for you. A* considers paths that go into the room, it can get out from it by exploring aroud the room and probably backtracking. I`d like to avoid backtracking and especially exploring in the room, so I was asking if it was possible to not consider the path. – user3124361 Jan 20 '15 at 23:33

0 Answers0