Pathfinding NPC BUG [SOLVED]

Pathfinding NPC [BUG]

Hey there developers! I’m at the moment working on an AI system for my NPC Monster but I’m having some problems! whenever my monster is turning from its destination parts it begins rotating from side to side and I really don’t understand why. I’ve tried fixing this for hours but I ain’t getting anywhere. Let me know if there already is a post about the same thing please let me know cause I can’t find any posts about this bug myself!

SCRIPT INSIDE OF THE MOSTER:

local Wendigo = script.Parent
local humanoid = Wendigo.Humanoid

local PathfindingService = game:GetService("PathfindingService")

local function getPath(destination)
	local pathParams = {
		["AgentHeight"] = 10,
		["AgentRadius"] = 2,
		["AgentCanJump"] = false
	}	
	local path = PathfindingService:CreatePath(pathParams)
	
	path:ComputeAsync(Wendigo.HumanoidRootPart.Position, destination.Position)
		
	return path
end

	local function WalkTo(destination)
local path = getPath(destination)
	
	
	
	for index, waypoint in pairs(path:GetWaypoints()) do
		humanoid:MoveTo(waypoint.Position)
		humanoid.MoveToFinished:Wait()
	end
end
	
while true do
	WalkTo(workspace.destination)
	WalkTo(workspace.destination2)
	WalkTo(workspace.destination3)
	WalkTo(workspace.destination4)
	WalkTo(workspace.destination5)
	WalkTo(workspace.destination6)
	WalkTo(workspace.destination7)
	WalkTo(workspace.destination8)

end


VIDEO OF BUG:


Thanks for reading I hope you can help me solve this!
`

Did you make sure the monster rig was correct, any parts anchored or its animation?

The monster rig doesn’t have a problem and I’m not sure what way it could be incorrect. Nothing is anchored and it currently doesn’t have the walk animation since I haven’t added it. If I should change that let me know!

Hello, sorry for the late answer it was late already. Maybe try making a quick walk/run animation and adding it to the monster, it might work but I’m not sure.

I already have someone make all animations to it and it still does the thing

Can you share a screenshot of the Humanoid properties?

So I played around with the hip height and realised that the hip height was too high which caused the trouble but now I don’t know how to get the feet to not go through the world.

1 Like

Maybe try changing the HipHeight Value while on game until it works correctly, that’s what I do when I get these problems.

1 Like

I don’t know why I didn’t think of that! Thanks a lot for the help I realised 3.14 gives a perfect balance and look for the character.

1 Like

There’s no problem, glad to help!

1 Like