PathfindingService can't find a path if destination is under a collidable part

Problem
PathfindingService seems to have an issue with calculating a path for the NPCs if the destination is underneath a part with CanCollide set to true. I want the NPCs to walk to a desk located inside a building, but the ceiling is preventing PathfindingService from calculating a path for some odd reason.
The ceiling is way above the NPC that there’s no way they’ll ever collide, so I’m pretty certain the ceiling isn’t obscuring the NPC’s path.

Attempts at a Solution

  • I set the ceiling’s CanCollide property to false, but this causes other issues: the player and the camera can go through the ceiling which is not desirable, and a second floor is impossible.
  • Along with the previous solution, I removed the line which checks a part’s CanCollide property from the CameraModule
    https://gyazo.com/9ea00a7739e14095a624ed262cea95ce
    This modification prevents the camera from going through parts with CanCollide set to false, but the player can still go through them, and a second floor is still impossible.

Question for The Community
Is there a reason why PathfindingService can’t calculate a path if the destination is underneath a part with CanCollide set to true?
I read in another post that ROBLOX’s PathfindingService is full of flaws and that some prefer to create their own pathfinding script, but I’m not certain I’m skilled enough yet to tackle something like that. Are there any other solutions besides writing my own pathfinding script?

Have you tried messing with the agent parameters of PathfindingService:CreatePath()?

AgentRadius Humanoid radius. Used to determine the minimum separation from obstacles.

AgentHeight Humanoid height. Empty space smaller than this value will be marked as non-traversable, for instance the space under stairs.

AgentCanJump Sets whether off-mesh links for jumping are allowed.

The AgentHeight property might be some odd value, or you might just have to lower it for roblox to think its a traversable path

If this doesnt work, it may be some form of union collision issue, which might be solved using the new fancy PreciseConvexDecomposition CollisionFidelity option, or just making any union in the general vicinity smaller/not a union

It could also simply be an invisible part or something like that who knows

You also might just want to look at the navmesh if you still cant find an issue, the instructions of how to show the nav mesh from the wiki are:

  1. Open the place in Studio.
  2. Navigate to FileSettings… .
  3. In the Studio tab, under Visualization , toggle on the Show Navigation Mesh setting. The mesh will then show up in the 3D view.

I did mess around with the agent parameters, but nothing changed no matter how small or large the values for AgentRadius and AgentHeight were.

Funny enough, all I had to do was raise the ceiling by another stud and that seems to have solved the issue. From my understanding, that should’ve been the same as just lowering the AgentHeight, but lowering AgentHeight did nothing.

Regardless, thank you for your help.

2 Likes