Improving Pathfinding Quality With New Algorithm

I’m still having issues despite using Pathfinding Modifiers and Costs as you can see by the nav mesh

my NPCs seem to ignore “DangerZone” and try to go right through it despite costs being so high

1 Like

how do you add a danger zone ?

You could make a check between waypoint one and waypoint 2, and compare the Y values, if its above 20 then dont take the drop

1 Like

When i enable the new pathfinding quality algorithm, nothing seems to change, npc still gets stuck sometimes, takes useless moves, hits the wall often or even sliders (agentsize paremeter doesnt work for some reason)


with canjump enable it does this… why??

1 Like

that works to an extent, the problem is that it would force me to generate a second path in the same time frame which would slow down pathfinding and it’d just start potentially missing drops that would be safe

1 Like

Something i noticed is the NPC’s wont take paths that are totally doable. For example here, i extended the part and the pathfinding said that its possible, but it didnt take extra steps, it jumped from the place where partialpath ended.

Here it is working
Here’s the code

if success and (path.Status == Enum.PathStatus.Success or path.Status == Enum.PathStatus.ClosestNoPath) then
	
		local WayPoints = path:GetWaypoints()
		Humanoid.MoveToFinished:Connect(function(bool)
			if bool and waypointthing < #WayPoints then
			
			Humanoid:MoveTo(WayPoints[waypointthing].Position)
			if WayPoints[waypointthing].Position.Y - WayPoints[waypointthing+1].Position.Y >= 5 then
				print("scared to take the  jump")
				return
			end
				if WayPoints[waypointthing].Action == Enum.PathWaypointAction.Jump then
					script.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
					print('jumping')
				end
				waypointthing +=1
			end
		end)
		Humanoid:MoveTo(WayPoints[waypointthing].Position)
		waypointthing +=1
	end

Waypointsthing starts off at 1 and counts up, its used to count how many waypoints have been “passed”

2 Likes