Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Am I missing something with this pathfind?

Asked by
drew1017 330 Moderation Voter
8 years ago

(The code is a simple pathfind script that computes a path and makes a part trail on it)

http://i.imgur.com/Pi8Fcuy.png

^ As you can see, the path seems to not be able to exist once it goes onto the sand, and i'm not sure why. Notes:

All of the walls and the floors of the bases are unions The sand is perfectly positioned next to the baseplate

0
For using an AI use ComputeSmoothPathAsync instead EzraNehemiah_TF2 3552 — 8y
0
There are going to be alot of NPC's, and they have very simple Ai, so raw path is better for performance purposes. drew1017 330 — 8y
0
Okay, Hmm I'll do more research and I'll give you the answer soon. EzraNehemiah_TF2 3552 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

The problem might be how the game sees if a part of the game is empty or not. ROBLOX's Pathfinding finds a path from point a to point b without any walls/holes. So when a space is 16% filled the game decides to say "There is a hole here!". This is because of the EmptyCutoff. It is set to 0.16 which is 16%. So if 16% or less of the 4x4x4 area is not filled, it is considered empty. To resolve this problem there is 2 solutions:


Resize the sand/base

There is a chance the sand/baseplate is too short and Pathfinding doesn't do well with small, thin parts. Resize it on the y axis, that might fix it! If not... Do next solution:


Change the EmptyCutoff

Change the empty cutoff to a number 0-1. If it's 0, then it will always be full, if it is 1, it will always be empty. Change this number to a reasonable number like 8% would mean you would have to fill more than 8 studs in a 4x4x4 area to be considered filled. Make sure it won't be too low or it might end up walking somewhere it shouldn't.

local pathfind = game:GetService("PathfindingService")
pathfind.EmptyCutoff = 0.8 --8%


Hope it helps!

0
This isn't working, even if I set EmptyCutoff to 0. The sand is 6 studs Y. drew1017 330 — 8y
Ad

Answer this question