PathFinding goes against obstacle, and doesn't listen to the cost

Ciao,
I’m Making a path finding where the Dummy has to go to the player. In the path there are trees, and street.
He has to avoid the trees and not go on the street, the only way to go on them is going on the pedestrian crossing.

The dummy doesn’t listen at all!
It goes against the trees and block it-self, only to go against another a few sec later. and when the trees have finished and there’s the street, it avoids the pedestrian crossing and goes directly on the street!

local PathfindingService = game:GetService("PathfindingService")
	local RunService = game:GetService("RunService")
	local AgentParameters = {WaypointSpacing = 5}
	
	--Humanoid
	local humanoid = Dummy:WaitForChild("Humanoid")
	
	--Animations
	local Folder = Dummy.Animations
	local Walk = humanoid:LoadAnimation(Folder.Walk)

	local path = PathfindingService:CreatePath({
		Costs = {
			SmoothPlastic = 5,
			Street = math.huge
		},
		AgentRadius = 2,
		AgentHeight = 5,
		AgentCanJump = false,
		WaypointSpacing = math.huge
		
	})

	path:ComputeAsync(Dummy.PrimaryPart.Position, Target)
	local waypoints = path:GetWaypoints()
	Walk:Play()
	for i = 1,#waypoints do
		humanoid:MoveTo(waypoints[i].Position)
		humanoid.MoveToFinished:Wait()
	end
	Walk:Stop()

Thank you all!

1 Like

Fixed somehow? but i don’t understand how it did get fixed.
I just put the following line.

AgentRadius = 5,

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.