Pathfinding Quirk

I followed the Character Pathfinding wiki page verbatim so if you wish to see my code, look no further than the web page.

Link: Character Pathfinding | Roblox Creator Documentation

I have an NPC that has a CanCollide false brick surrounding them that the players make CanCollide on their client. I made the loop in my script log the players position and only recalculate the path if they deviate from their position by 2 studs. What I’ve found was, when the path is calculated once and the NPC starts following it, everything works perfectly. But when the player moves and it starts constantly recalculating the path, even though the part is CanCollide false and I put a modifier with pass on it, it still have the AI zig zag to walk around the brick? I have no clue why this is happening, if someone who is more experienced in pathfinding can assist me with this, I’m getting mad flustered lol.

Can you post your code and a screenshot of what the Pathfinding map looks like (You can see this in studio settings and turning on navigation map iirc)

It’s possible that the NPC’s pathfinding algorithm is not taking into account the CanCollide false brick surrounding them, even though it has a passable modifier on it. One thing you could try is to make the CanCollide false brick a part of the NPC’s HumanoidRootPart instead of having it be a separate part.

Another thing to check is whether the NPC’s pathfinding algorithm is set to avoid obstacles. If it is not, then the NPC may not be taking the CanCollide false brick into account when recalculating the path. You can check this by going to the NPC’s NavigationAgent object and making sure that “AvoidObstacles” is set to true.

If neither of those solutions work, you may need to adjust the size or shape of the CanCollide false brick to better fit the NPC’s movement. Additionally, you could try adding additional passable modifiers to the areas around the CanCollide false brick to give the NPC more options for pathfinding.

I hope this helps!

Code is literally copied and pasted from the wiki page posted, I loop and call the function to path find.

The nav map shows 0 obstacles and it paths perfectly to me but the first nodes always offset to the left or right to side step the brick for some reason.

I have 0 clue because I made its cost 1, I made it CanCollide false on the server so it shouldn’t even CONSIDER it. I haven’t peeped NavigationAgent so I will look into this but its kind of frustrating because it has 0 documentation on why this issue may be occurring.

If you have modifiers, the part that the modifier is parented to HAS TO BE CanCollide = true. You can setup CollisionGroups if you want to be able to walk through those parts.

ill attempt this real quick and clip the results

edit with results:

https://i.gyazo.com/d71e2975025d30c912cbfdede613ec28.mp4

it appears to work decent when its alone but when there’re multiple npcs it freaks out and goes left and right quickly before trying to continue path finding.