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

Pathfinding ignores walls?

Asked by 9 years ago
local plr = game.Players.LocalPlayer
local char = plr.Character
local pfs = game:GetService("PathfindingService")

script.Parent.MouseButton1Click:connect(function()
    local pad = workspace:FindFirstChild("TPad"..math.random(1,3))
    local path = pfs:ComputeSmoothPathAsync(char.Torso.Position, pad.Moveto.Position, 500)
    local points = path:GetPointCoordinates()
    print(path.Status)
    local model = Instance.new("Model")
    model.Parent = workspace
    for _, point in pairs (points) do
        local part = Instance.new("Part")
        part.Size = Vector3.new(1,1,1)
        part.Anchored = true
        part.CanCollide = false
        part.Parent = model
        part.Position = point
    end

This script causes the player to follow a path to the endpoint. For some reason, when the path is created, it seemingly ignores walls, causing the player to smack right into them! The walls are two studs deep and the Status is always ClosestOutOfRange (which I don't understand, because the endpoint is very close to the player). Can anyone help?

0
try making the walls 4 studs thick? that may or may not make a difference because roblox pathfinding service runs on a 4x4 grid i believe xolbStudios 127 — 9y
0
^ That would be the case if he was using ComputeRawPathAsync() but since he's using a smooth one it's different. SquirreIOnToast 309 — 9y

Answer this question