Pathfinding being annoying

Hi,

I am having an extremely difficult time with getting NPCs to walk through a door. Pathfinding has a stroke here for some reason.


Why does he think he can go on top???


Really do not understand the issue here.

1 Like

Can we see the code that is being used for the pathfinding?

1 Like

I am using SimplePath.

here are my agent parameters;

{NoPath = 99, AgentRadius = self.Config.Radius or 1.9, AgentHeight = self.Config.Height or 2}

Here’s how I chase after players;

local EnemyRoot = obj.Target.PrimaryPart
			local Root = obj.Character.PrimaryPart

			local EnemyPos = EnemyRoot.Position
			local RootPos = Root.Position

			local V1 = EnemyPos * Vector3.new(1, 0, 1)
			local V2 = RootPos * Vector3.new(1, 0, 1)

			local Direction = (EnemyPos - RootPos)

			local Position = EnemyPos

			local Velocity = EnemyRoot.AssemblyLinearVelocity
			if Velocity.Magnitude < 0.1 then
				Velocity = Vector3.new()
			end

            if Direction.Magnitude > 4 then
				obj.Pather:Run(Position + Velocity / 8)
			end

			task.spawn(function()
				task.wait(0.5)

				obj.Bools.CanPath = true
			end)

This position calculation has always worked even indoors. The doorways are the only issue.

1 Like

try decreasing agent radius/height (fallback too) and see if that changes anything

1 Like

You need to create some sort of pathfinding modifier, or disable CanTouch and CanQuery.

1 Like

Yes. One of the images shows the pathfinding modifier…

1 Like

I have decreased it but then they get stuck on the sides of doors by hugging corners really hard. I can’t seem to find any inbetween.

1 Like

And did you set the cost to zero or a lower value than just jumping?

3 Likes

This did work.

But. It only worked when I removed the roof, which makes zero sense. They had the low enough height to path through the doorways. Why does the roof break it?

2 Likes

Nevermind, managed to fix by increasing ceiling height. Really annoying though.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.