# Pathfinding diagonals bug

0 favourites
• 4 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
• Problem Description

Pathfinder find path where it should not, in in the diagonals.

Even an object with a size of 1x1 could not pass and follow the returned path.

Attach a Capx

https://www.dropbox.com/s/ta0lowufer55sm6/PathfindingProblem2.capx?dl=0

Description of Capx

Here's a little capx to display a pathfinding problem. Any click to move the red sprite. Try to go left or right and see that it can pass through diagonal walls. R to retry and space to display obstacle map.

Steps to Reproduce Bug

Just try to go behind the walls. In theory it's impossible because there's not space between tiles. Try to go into the enclosed area on the right and see that you can pass through wall, but you cannot find out path.

Observed Result

Object find path through walls hen diagonal movement is enabled.

Expected Result

Find good path, because the pathfinder leads the object to bounce against walls if piloted by physics or other movements.

Affected Browsers

• Chrome: (YES)

Operating System and Service Pack

Windows 7 SP1

Construct 2 Version ID

Construct 2 Release 223

• ## Try Construct 3

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

Construct 3 users don't see these ads
• Not a bug.

From the manual:

[quote:2ivd3n3b]The Cell border property can adjust how cells are marked as obstacle. If the border is larger than 0, then cells close to obstacles but not actually touching may also be marked as obstacles, effectively giving an extra "obstacle border". If the border is negative, cells only just touching an obstacle may not be marked as an obstacle, effectively shrinking the obstacle area inwards.

You have the cell border property set to -1 in your example.

So it is impossible to get right path with pathfinding and cell size the same as tile size ? I don't really understand. In the example the tiles in diagonals in the walls are marked as obstacle, even with -1 cell border.

Also, as you can see in the example, the pathfinder put nodes right on top of declared obstacles. I think it's actually a bug. I modified the project file in example and added a enclosed zone to the right of the layout. See that you can go in there (Pathfinder put a path node on a declared obstacle), but you cannot go out from there.

• Closing as your pathfinding behavior has diagonals enabled, so it is set to do what you are seeing. If you think there are any other issues please file separate reports.

• 4 posts