Pathfinding enemy clipping through obstacles

0 favourites
  • 4 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hello again! I recently went through the excellent pathfinding/line-of-sight tutorial on the site but even with having the helper sprites in place, there's one spot where the enemy will still clip through the obstacles and I can't figure out how to fix it.

    If you look at the test.capx file, go through the red door so the enemy will see you, and then hide back inside the room on the right hand side. The enemy will clip through the two helper sprites and the wall sprite to get to you, but if you hide on the left side, it will go around them like it's supposed to. All suggestions for how to get around this are welcome!

    Also I should mention I've tried playing around with the cell size and cell padding values with no effect on that one side.


  • the pathfinding nodes are positioned at the top left of the cells.. so the enemy will navigate on the lines rather than the gaps.

    one solution could be nudging everything in the layout up and to the left 16 pixels.. then it will look like thee nodes are positioned in the centre of cells on your tiled background.

    i set the cell size to 32 aswell and it seems to be go through the door ok without clipping.

    i dont often use pathfinding though, so there's probably a better way to fix this. without having your whole layout constantly offset

  • Thanks Keepee. I'll try changing the cell size and see if that makes a difference.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've gotten better results with using a cell size of 28.. with 32 the enemies wouldn't go through the doorway at all... but i'm still having some issues on some of the other doorways where the enemies won't come through the doorways now. I'm wondering if it would be better to just have the obstacles set to anything solid instead of using the custom obstacles with the helper tiles.

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