Pathfinding not moving all the way on small Humanoids

I am trying to make a humanoid path find to a part. Both the part and Character are very small, the scale on the character is 0.2 and the block’s size is 0.2,0.2,0.5. I noticed the Character not moving all the way to the part even though the waypoint is right over the part.
image
(small floating part is the waypoint)

But I noticed that when the character and part are normal size (1) then the Character moves right up to the part.

How I think this works is that the regular sized character moves right up to the waypoint, so that the waypoint is right in front of it, not so the waypoint is in the middle of the character. Then when the character is shrunk. It keeps the same offset as when it was normal size, meaning that the part is proportionally the same distance away while looking further away.

Is there any way to make the Character move closer to the waypoint in the first photo?

local PFS=game:GetService("PathfindingService")

local Head=script.Parent.PrimaryPart
local Humanoid=script.Parent.Humanoid

local Path:Path=PFS:CreatePath()
wait(2)
Path:ComputeAsync(Head.Position,game.Workspace.FinalPart.Position)

local Waypoints=Path:GetWaypoints()

for i, Waypoint in ipairs(Waypoints) do
	local Part=Instance.new("Part",game.Workspace)
	Part.Position=Waypoint.Position
	Part.Anchored=true
	Part.CanCollide=false
	Part.Size=Vector3.new(0.1,0.1,0.1)
end

for i, Waypoint in ipairs(Waypoints) do
	Humanoid:MoveTo(Waypoint.Position)
	Humanoid.MoveToFinished:Wait(2)
end
1 Like

Try passing some agent parameters to :CreatePath() to tell PathfindingService how you want it to handle the smaller character.

local PathfindingService = game:GetService("PathfindingService")
local Path: Path = PathfindingService:CreatePath({
    AgentRadius = .2,
    AgentHeight = 1,
    AgentCanJump = true,
    AgentCanJump = true,
})

For more information on this function, refer to: Character Pathfinding | Documentation - Roblox Creator Hub

Additionally, as per this post, if your character is too small, it will never be able to reach the position as it will try to travel up/down to reach the final waypoint but it will not be able to. Try computing a path from the HumanoidRootPart.Position (e.g. Path:ComputeAsync(HumanoidRootPart, ...), or altering the position of the FinalPart.

1 Like

When I try to change AgentRadius and AgentHeight. I don’t see any visible change in where the Character stops.
Even if I set both to 9, the Character stops in the same place, same as 0.2 and 1.
image
(Image above set with AgentRadius = 0.2 and AgentHeight = 1)

Is this expected?

local PFS=game:GetService("PathfindingService")

local Head=script.Parent.PrimaryPart
local Humanoid=script.Parent.Humanoid

local Path = PFS:CreatePath({
	AgentRadius = 0.2,
	AgentHeight = 1,
})

wait(2)
Path:ComputeAsync(Head.Position,game.Workspace.FinalPart.Position)

local Waypoints=Path:GetWaypoints()

for i, Waypoint in ipairs(Waypoints) do
	local Part=Instance.new("Part",game.Workspace)
	Part.Position=Waypoint.Position
	Part.Anchored=true
	Part.CanCollide=false
	Part.Size=Vector3.new(0.1,0.1,0.1)
end

for i, Waypoint in ipairs(Waypoints) do
	Humanoid:MoveTo(Waypoint.Position)
	Humanoid.MoveToFinished:Wait(2)
end

Thank you for telling me about this though, I’m sure this will be very useful.

1 Like

Yeah because the agent parameters are broken, and the only thing u can do rn is to
a.) complain about it on dev forum (I think there is a bug report about it)
b) make your own pathfinding system(which is like insanely hard)

2 Likes