GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

Pathfinding ignores obstacles depending on cell size

Open PascalLadalle opened this issue 3 years ago • 2 comments

Following some help request on the Discord, I experimented with the pathfinding, and found that in certain conditions, it didn't care much about the obstacles. Here's the test level: image

Black is the pathfinder (128 px size), X marks the target, red are impassable obstacles (100 px). Default hitboxes are used for all objects.

Black shouldn't be able to go through the upper slot in front of it, it is too narrow. But if its virtual cell size is set to 20 px, it walks over the red ones as if they weren't there. image If I set the cell size to 40 px, black goes through the lower slot, but bites on the edges of red. If I set the cell size to 60 px, black goes through the lower slot, all is well.

So it looks like the cell size must be at least half of the obstacle size, or they are ignored.

PascalLadalle avatar Jun 06 '22 12:06 PascalLadalle

Can you try this with "draw pathfinding" extension and "draw collision mask" actions?

tristanbob avatar Jun 06 '22 13:06 tristanbob

Cell size 20 px: image

25 px: image

27 px: image

The upper slot is 72 px high (per 100 px wide).

PascalLadalle avatar Jun 06 '22 15:06 PascalLadalle