GameMaker The path found by mp_grid is not actually passable.

D

Dodo

Guest
Hi guys, i'm new to GMS, it's nice to be here.

I fixed the issue, see the second post.
 

Attachments

Last edited by a moderator:
D

Dodo

Guest
Update: In draw_path i gave wrong coordinates my bad, that's why path seems shifted, this is how it actually is.

path2.png
 

Yal

🐧 *penguin noises*
GMC Elder
When you fix an issue yourself, you shouldn't delete the original issue text... now people won't know WHAT you fixed and can't learn from it. Probably doesn't matter in this case since it wasn't a code issue, but please keep it in mind for the future.
 
D

Dodo

Guest
Thanks @Yal, i will remember next time.

There were two parts of the question.
First, i thought the path overlapped the forbidden cells, it was my mistake.

Second, mp_grid_path gives you a path even if your object is not able to pass through because of large collision mask. So it only cares if a path exists with continuous free cells. I also verified it. It was silly to expect that since the function doesn't take any object as a parameter.
 

Yal

🐧 *penguin noises*
GMC Elder
Second, mp_grid_path gives you a path even if your object is not able to pass through because of large collision mask. So it only cares if a path exists with continuous free cells. I also verified it. It was silly to expect that since the function doesn't take any object as a parameter.
Ironically enough, the OPPOSITE generally happens more often (cells get flagged as unusable despite there being room because there's a slight overlap). I remember the manual bringing this up and mentioning that the right grid size is paramount for good results, but I'm not sure if the exact same text was ported to GMS2.
 
I

icuurd12b42

Guest
Weird though, I'm pretty sure the size of the object, it's mask, was used in the mp_grid_path call in earlier gm versions...

However your cells should be large enough to allow passing of your instances, it just makes things more efficient... no sense having 4x4 grids if your instances are 32x32
 
Top