Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

PathfindingService tries to go through walls?

Hi guys.

I've set up an NPC pathfinding script which works using the ROBLOX Pathfidning service, however quite often, it takes a long unecessary route AND tries to go through walls so it gets stuck.

Is there a way to fix either of these problems?

I've tried everything I can think of (And yes, the walls have CanCollide set to true)

Thanks!

3 comments

0

please give us the code

0

Updated.

0

are the walls thin?

1 answer

✓ Accepted answer

Your walls may be too thin
Performance over perfection

In order for the pathfinding to be effective, it breaks your game down into voxels. If a voxel is a certain amount filled (As a percentage 0-1) it treats it as filled, and won't try to pathfind through it. This is okay in most cases, except in cases where thin walls are used. Try tweaking EmptyCutoff until it works.

4 comments

0

OK, thank you - I've tweaked it to 0.08 (Half of the original) and this is still happening :/ http://prntscr.com/dawvfo

0

Tried it on 0.03 as well and made no difference!

1

Looks like your fence may intersect voxels vertically too. Try creating a fake wall there to also trick NPCs, or make your own pathfinding using nodes.

0

Ah, true! Thank you! And any ideas why it may be taking a long unecessary route when there is a much shorter one with no obstacles?

This discussion is preserved as it was. New answers, comments, and votes are closed.