Help: NPC Pathfinding, with PathFindingModifer, Ignore Obstacles not working

Hello,

Why is the NPC not using the PathFindingModifier logic and going through the Green and Blue Part? If I delete the Blue Part, the NPC goes fine back and forth to the two waypoints.

Here is .rbxl, so you can easily see and perhaps help debug the problem. I also put in print debug statements in the script.
NPC Pathfinding with PatFindingModifier Ignore Obstacles true.rbxl (61.2 KB)

I have an NPC with Pathfinding and two waypoints. Where creating a Part name ‘NPC go through’ (green part), Anchoring it, setting CanCollide to false, adding a PathFindingModifier, with PassThrough = true. I am using the PathFindingModifer so that it should ignore the Door (Blue Part) part and walk through it, because the Green Part has the PathFindingModifier, Anchored, with Collision off. (AND the PathFindingModifer under it)

I also made sure to scale the Green part bigger then the Blue part.

I am following this Roblox document, which says this should have the NPC ignore the Door and go through it.

Why is the NPC not using the PathFindingModifier logic and going through the Green and Blue Part?

The NPC does not move if the Blue block is there.

Script.

(also does anyone know the newer script syntax for this line, that is depreciated ?)
rayParams.FilterType = Enum.RaycastFilterType.Blacklist

Thanks

3 Likes

What did you name the label of the pathfindingmodifer. That should be the same as the cost index so put “Door” as label of the pathfindingmodifier.

1 Like

Not sure, very strange behavior. I got a fix for it. You can do either one of the two:

  1. have both the door and the region be very similar in size, rotation, and position (this method is good if you have a multi part door)

  2. delete the region and just put the PathfindingModifier inside the door itself (I recommend this one to reduce part count, but ONLY If the door is 1 single part)

Not sure why that fixes it. I’ve been working with the pathfinding for a very long time. That specific tutorial page you linked is very old. It may be a new roblox update or a bug. Either way, seems like you can get around the issue by doing the step above.

1 Like

This is pretty cool. Didn’t know pathfinding could even do objects. But I do know it can do part “textures” like sand or slate … from the terrain. However you can just make a flat part and place it on the floor with transparency set set the cost on that to super high and they will not ever try to walk over it.

1 Like

Hi,
On your two examples, what are the property settings for the first two parts, and PathfindingModifier , and the second example the part and pfm… spefically for the parts the cancollide value?

Thanks

And I think I already tried 1, and it did not work… (the green part ((with the pfm) was bigger though, not exactly as small as the door… I thought bigger would have been better)

1 Like

Hello!

The reason for this is because Enum.RaycastFilterType.Blacklist & Whitelist are deprecated. Use Exclude in place of Blacklist & Include instead of Whitelist.

Hope this helps! :slight_smile:

1 Like

ok I have done that, what is the difference between blacklist and whitelist…?

also how do I put a part into one of them?

Thanks

2 Likes

Try this: RaycastFilterType | Documentation - Roblox Creator Hub

What do you mean by that?

1 Like

put a part into a blacklist or whitelist… I was thinking that is what they contain…

1 Like

Hi, attached are the updated the files to your place.

PathfinderFix.rbxl (61.4 KB)

In your current setup, the blue block is just a block. This is the navigation mesh on your green block:

This is it on the blue:

As you can see, on the green one, there’s arrows going from one side to the other. This means it’s passthrough enabled. The blue one, however, looks exactly like the walls. That means it doesn’t allow passthrough.

So even if it can go through the green one, it most certainly won’t get through the blue one. And as the blue one is inside the green one, that means it also won’t be able to (fully) get through the green one. The solution is to either add the pathfindingmodifier to the blue part too, or to just make the green part the door. In a real game, you’d probably just want to make the door-mesh have the pathfindingmodifier.

Also, the fact that the green part is non-collide probably means the pathfinder ignores it, because it wouldn’t be able to use it as a surface to walk over, and it also wouldn’t consider it an obstacle.

As for the deprecated terms of ‘whitelist’ and ‘blacklist’, Roblox has wokified luau, and according to the law of the blue haired these terms are unacceptable now. So they use exclude/include.

wow! thanks for digging into it and explaining it so well!
Thanks

Thanks, I will check it out. Thanks for looking at it and sharing a file back.