How do I make pathfinding work correctly?

0 favourites
  • 6 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • Okay, first off, i know title doesnt explain really well, but I'm having this problem. I tried a sprite with the pathfinding behaviour, so when you click on it, you choose somewhere in the map with the mouse, and the sprite moves there. It was all working good in a blank project sheet, but as soon as i put obstacles in (with solid behaviour), the pathfinding sprite won't move. Whenever I tell it to go like, 10 feet in front of it, it works, but when i tell it to go at the other side of a wall, it stops working.

    I know i dont explain very well, but i hope you understand "^^

  • Okay, first off, i know title doesnt explain really well, but I'm having this problem. I tried a sprite with the pathfinding behaviour, so when you click on it, you choose somewhere in the map with the mouse, and the sprite moves there. It was all working good in a blank project sheet, but as soon as i put obstacles in (with solid behaviour), the pathfinding sprite won't move. Whenever I tell it to go like, 10 feet in front of it, it works, but when i tell it to go at the other side of a wall, it stops working.

    I know i dont explain very well, but i hope you understand "^^

    Trying to fix pathfinding problems from just an explanation is nearly impossible - there are just too many things that could be wrong, e.g. cell size.

    It would make it much quicker if you provide a .capx which highlights your problem.

    BTW does the built-in pathfinding examples work correctly for you? If so, you may be able to see where you have gone wrong.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > Okay, first off, i know title doesnt explain really well, but I'm having this problem. I tried a sprite with the pathfinding behaviour, so when you click on it, you choose somewhere in the map with the mouse, and the sprite moves there. It was all working good in a blank project sheet, but as soon as i put obstacles in (with solid behaviour), the pathfinding sprite won't move. Whenever I tell it to go like, 10 feet in front of it, it works, but when i tell it to go at the other side of a wall, it stops working.

    > I know i dont explain very well, but i hope you understand "^^

    >

    Trying to fix pathfinding problems from just an explanation is nearly impossible - there are just too many things that could be wrong, e.g. cell size.

    It would make it much quicker if you provide a .capx which highlights your problem.

    BTW does the built-in pathfinding examples work correctly for you? If so, you may be able to see where you have gone wrong.

    Okay, i would provide the cap, but I'm kinda new to the forums and I don't know how, could you explain me? If so I'll do it

  • TheCreepy12 Does it work if you set the cell size to a smaller value? Like 5 or something

  • TheCreepy12 Does it work if you set the cell size to a smaller value? Like 5 or something

    I've actually tried setting it to even 1, still doesn't respond, I'm going to try and explain what I say with a "drawing"

    So, If i tell the sprite to go from point A, to point B "[ A -----> B ]" it works, but when i tell the sprite to go from A to B, with a wall in front, it doesnt "[ A ---[]---> B]"

    I hope you understand better with that kind of explanation, and obviously, there is more space up and down for the sprite to move

  • Try this:

    On click --> calculate path to destination

    then

    On path found ---> move along path

    Make sure that your obstacles has the solid bahaviour and also solids is added as a obstacle in the pathfinding behaviour

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