Generating Navmesh for 2d Sidscroller using Tilemap

I am trying to get an AI to follow a player in a 2d sidescroller using a tilemap, but I can’t seem to get the AI to move. I believe it is because no path is being built when I insert a Nav Mesh Bounds Volume. That is, no green areas or lines are being produced.

I have tried:

  • Toggling show navigation (P) on and off
  • Rotating the Nav Mesh Bounds Volume 90 degrees
  • Increasing the collision thickness of my tilemap between 100 and 500
  • Rebuilding paths
  • Changing Nav Mesh generation settings like cell size, height, agent radius (although to be honest I’m not 100% certain what these settings do)

I’ve included a picture to help demonstrate what I have set up. The selected box is the Nav Mesh Bounds Volume. The background layers do not have collision enabled, so they shouldn’t be in the way. The character in the centre is the AI character that is meant to follow the player. As you can see, there are no green areas indicating valid paths.

When I run the game, the AI correctly executes a sphere trace to find the character then a line trace to see if the character is in line of sight. I can see by looking at the values that it correctly identifies the player. Then it calls AIMoveTo, but it is aborted and the AI character does not move.

Thanks for your help in advance!

I’m still interested in any answers/suggestions if anybody has anything.

i had the same issue. increasing my nav mesh size (on it y component) to 100 fixed it

Sorry, I’ve tried changing the nav mesh dimensions on all three axes. I’ve also tried changing the collision dimensions of my tilemap actor, but none of it worked for me.

sorry, im fairly new to ue4 so i dont know much, i wish i could help your game looks amazing so far

So I still can’t fix the problem, but I did manage to find a workaround. I found that if you place a static mesh cube with simple collision inside a nav mesh bounds volume, it will generate the navigation paths. I then put the static mesh at the same height as the floor in my level and set it to not render during play. The AI just uses this instead and it seems to work. I’m still interested in an actual solution if anyone has one.

Thanks! And thanks for trying anyway!

Actually, messing around with it a little more I found the nav paths generate for my regular floor when I put the static mesh inside the nav mesh bounds volume, regardless of its position.

I was able to find a solution by increasing the Tile Map Collision Thickness to ~100. This is because the Nav Mesh is always casting down, so unless you change your entire game to be on a different axis, this is the best way in my opinion.

251113-pic.png

2 Likes

Only increasing the size of the tile map collision thickness to ~100 didn’t fix my problem but decreasing the cell size and height to 1 in Project Settings → Navigation Mesh worked out for me.

2 Likes

I faced this problem just now, but an idea came to my mind and it is working now. I threw a cube under the area where the AI would move and hid it in-game. green areas are currently appearing on the cube and the AI is moving.

worked for me

If you work with tile set go to Project Settings >> Navigation Mesh >> Cell Size 4, Cell Hight 2, Agent Radius 4, Agent Height 4, Max Simplification Error 0,1. After that go to Outliner >> Recast Mesh >> Agent radius 8.

2 Likes