Terrain originally created using heightmap won't generate a Navigation mesh?

Just noticed my Mobs weren’t using at all the VoxelTerrain for pathfinding in one of my maps, turned on “Show Navmesh” and Navlinks in Studio and… no Navmesh on terrain, only in very specific places at the edge of the map. modifying the Navmesh will sometimes work, but as soon as you refresh the Terrain (closing and opening it again, pressing Play, etc.) the Navmesh is again, gone.

The image bellow shows the only place where a Navmesh exists in the entire Terrain, which varies a lot in form, heights and shapes.
image

This was replicated on every attempt to import terrain by heightmap, using a variety of heightmaps, in multiple Places, even a clean one made just for this purpose.

so… what’s going on, exactly? my other (older) maps, also generated by Heightmap Imports and later manually finetuned all work as they should, but somehow now it doesn’t work? even manually created Terrain has no Navmesh at all when terrain is imported.

Am i missing something? making a mistake somewhere? all of this was working fine, one of my other maps was created not more than two months ago using this same method, but now it bugs out?


EDIT: This can be fixed by deleting/replacing the bottom layers of Lava/Bedrock that come with the terrain when you import something with a high foundation.


The Code bellow was made for a quick deletion of the entire Lava/Bedrock region without having the use the depressing “Region Selection” Tool.

Replace the values of P1 and P2 with your own, they act as the opposite corners of the Region 3, you can also change the Material with something else for a replacement instead of deletion.

local MaxRegionSize=500 local P1=Vector3.new(-3050,-50,3050) local P2=Vector3.new(8550,30,-3050) local _Material=Enum.Material.Air

local minP=Vector3.new(math.min(P1.X,P2.X),math.min(P1.Y,P2.Y),math.min(P1.Z,P2.Z))
local maxP=Vector3.new(math.max(P1.X,P2.X),math.max(P1.Y,P2.Y),math.max(P1.Z,P2.Z))

local cX,cY,cZ=((maxP.X-minP.X)/MaxRegionSize),((maxP.Y-minP.Y)/MaxRegionSize),((maxP.Z-minP.Z)/MaxRegionSize)

local eX,eY,eZ=(cX-math.floor(cX)),(cY-math.floor(cY)),(cZ-math.floor(cZ))
local fX,fY,fZ=math.floor(cX),math.floor(cY),math.floor(cZ)

local _mainC=0
for wX=1,fX+1 do local _LX=((wX-1)*MaxRegionSize) local _X=tonumber(MaxRegionSize) if wX==fX+1 then _X*=eX end
	for wY=1,fY+1 do local _LY=((wY-1)*MaxRegionSize) local _Y=tonumber(MaxRegionSize) if wY==fY+1 then _Y*=eY end
		for wZ=1,fZ+1 do local _LZ=((wZ-1)*MaxRegionSize) local _Z=tonumber(MaxRegionSize) if wZ==fZ+1 then _Z*=eZ end 
			local sP=minP+Vector3.new(_LX,_LY,_LZ) eP=sP+Vector3.new(_X,_Y,_Z) workspace.Terrain:FillRegion( Region3.new( sP,eP),4,_Material)
			_mainC+=1 if _mainC==50 then wait() _mainC=0 end
		end
	end
end
2 Likes

Not sure if this is your problem, but I’ve noticed that if I build a terrain when the beta feature “Upgrade Shorelines” is enabled, the navmesh does not generate correctly. Sorry, for the late post, I had to wait 10 days before my account could post here.

1 Like

Hmm, the window of time of when the bug started happen matches the release of the new Shorelines, that’s the best guess so far, i’ll check it out.


Edit: Unfortunally, not the cause.

I’ve already fixed the problem tho, but couldn’t fix the bug itself, just “patch” it, but deleting/painting over the lower layers of Lava/Bedrock that generate when you Import a terrain, somehow, any external layer of it left unchanged will destroy the Navmesh generation.

Even tho it appears fixed (on Studio Editing) by manually “updating” a chunk by editing the terrain/painting it, after you removed any small part of Lava/Bedrock, it’s not, when you hit play it’ll regenerate the Navmesh from scratch and any chunks where you didn’t apply the fix will be bugged.

I Wish i had more info to post a bug report, but AFAIK i’m one of the few people who has been affected (or even noticed) this thing, so it’s not that urgent.

2 Likes

Did you run this in your command bar? Im having the same issue now!

Edit:

Using the new terrain select tool its much more effortless. My Lava/Bedrock layer was super thin too! Thanks!

1 Like

Glad this could help.

Haven`t used the new selection tool that much yet, what’s the size limit on it? the old one would have to be used a hundred times at least to clear my map, and reselecting after the smallest missclick was hell.

So far I’ve hit no limitation on selecting terrain, that’s the best part! Thousands of studs!!

1 Like

I’m seeing a similar problem with pathfindingservice and terrain that doesn’t have anything to do with import. The paths and terrain mesh completely ignore non-water terrain. This seems to have broken recently as it was working properly in my older games.
To reproduce, use baseplate map, generate 1000x256x1000 terrain, select Hills, Water, Marsh. move baseplate below terrain, and visualize a path across the terrain using a plugin:



You can see that the pathfinding service now completly ignores non-water terrain, and places waypoints below the terrain on the underlying baseplate rather than the terrain surface (because it looks like the nav mesh isn’t being built for the non-water terrain).

1 Like

Exactly, you may also notice that it can be forced to generate on Studio by updating it manually with some terrain editing in what i supposed is part of the terrain which is generating the problem, but this “updating” is merely visual for that run of Studio, since it’ll generate again wherever you re-enter “edit mode”.

Something is preventing Terrain from generating a Mesh, that something is Terrain, that Terrain is generated on the lowest layers of the Terrain, that something is preventing all pathfinding related to Main Terrain (so, non-water) to be generated.

From what i’ve seen since then, it’s the Cracked Lava layer, but could be something else related to terrain height on auto-generation or import (but i doubt it).

1 Like

I noticed that the incorrect nav mesh problem doesn’t occur when using the Suchi’s infinite terrain plugin, which dynamically generates terrain chunks in thin layers. There is no depth or cracked lava base layer with the plugin.

2 Likes