How to make pathfinding go to "exact" location?

0 favourites
  • 7 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Okay, so if we had a top-down or isometric game, and we wanted a hero to move to an exact location, how do we go about this?

    I set up a quick capx example. Now, the blue box should be "completely" overlapping the green box, but it always stops right in front of it. I tried playing with cell size and whatnot, but it didn't ever seem to stop where I wanted. I want it to land on it dead center.

    Think of the green box as a marker rather than a sprite. It would be an invisible marker that indicated exactly where the hero would stop walking. While it is close enough for normal games, it would not really work as well if you wanted tile-based floors since the hero would never be centered (the green box would be centered on each tile).

    I don't know if what I'm trying to do is even possible, but I thought I'd post here and see. Obviously, this could be done with other behaviors than pathfinding, but I need them to walk around obstacles or walls.

  • Hi DrewMelton - xPos and zPos is no good?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • hundredfold I'm afraid I'm not sure what you mean. Can you be more specific?

    I have it set to go to the target's x and y coordinates. With the image point in the center, I assumed it would go to the center, but it always stops right in front of the object.

    There could be 20 or 50 of these targets in a single level, so I will not know the exact coordinates beforehand. I'm just not sure of any other way to set it up to be more exact.

    Anyway, thanks for the help. If you could clarify what you meant, I will look into it some more.

  • Have you checked the origin point of your images? - double click on an image so the edit image box appears, select the second to last icon down the left hand side and see where the little marker is positioned on your image.

  • Yes, I have the image points for both objects set to center. I even tried moving them to the edge to see if it would go further, but it didn't make any difference, so I put it back to middle.

  • You'd have to use On pathfinding arrived to trigger a final behaviour to finish the precise positioning (LiteTween) & orientation.

  • You'd have to use On pathfinding arrived to trigger a final behaviour to finish the precise positioning (LiteTween) & orientation.

    I figured that'd be the case. After doing some more tests, I ended up using the moveTo behavior for the final adjustment. I just need to make sure it doesn't look too awkward. I don't want my characters doing a nice walking animation and then sliding into place at the last second. These will be 3d models that I will be building and animating. I'm just using placeholders from old games for now.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)