Pathfinding

0 favourites
  • 7 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • How do I get a sprite, using the Pathfinding behavior, to -

    1.) Check the next single cell of its path for obstacles, (cell of the A* grid).

    (The very next cell mind you, cant afford to regenerate the whole path every time it scans for an obstacle.)

    2.) Choose between moving into the cell (if the cell is not obstructed)

    OR performing an alternative action (if the cell is obstructed).

    3.) Repeat.

  • 1. you can't

    2. you can't

    3. ok

    1 - you can't check nodes where something will move. when you regenerate map for movement it creates nodes on the map. and when you use find path it uses nodes that go closest to your target x,y

    2 - if you don't have collisions on that object and is not an obstacle then your sprite will move through it, else it will already go around it

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 1 - Why? What happens to the grid during all of this?

    2 - The built in collisions when misused as a workaround for bad pathfinding not only eat your processor alive, they do not yield reliable or useful results.

  • Let me ask a different question -

    How do you determine what cell that an object using the pathfinding behavior will move through next? (cell coordinates not layout coordinates)

  • You have the option to check whether a Cell is an obstacle or not using the path finding. So you could use that for checking.

    You also have the option to regenerate obstacle map around certain objects, might be useful as well.

    The cell size is based on the settings in the path finding. So if cell size is set to 30 each cell will be 30x30 pixel so you could use this information to make a functionality to check cells around the object.

  • [quote:sv0172v6]"You have the option to check whether a Cell is an obstacle or not using the path finding. So you could use that for checking."

    Yes, this is my point exactly. So how do you do it?

    [quote:sv0172v6]"The cell size is based on the settings in the path finding. So if cell size is set to 30 each cell will be 30x30 pixel so you could use this information to make a functionality to check cells around the object. "

    How?

  • you find your answer in these demos

    https://www.dropbox.com/sh/eioscti86bpr ... 7YPza?dl=0

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