Bad PathFinding

I’m trying to make a pathfinding system just like other tower defense games, such as Tower Battles and Tower Defense Simulator.

The Issue is my Enemies are Sliding on corners, and they also dont go along the path perfectly straight.

I have tried looking for other posts and tried searching for videos on a better pathfinding system but I couldn’t find anything, I’m new to scripting pathfinding.

So is there a better pathfinding system I can use? here’s what I am currently using.


-- Variables

local zombie = script.Parent
local waypoints = workspace.WayPoints

-- Script

for waypoint=1, #waypoints:GetChildren() do
	zombie.Humanoid:MoveTo(waypoints[waypoint].Position)
	zombie.Humanoid.MoveToFinished:Wait()
end

Can you show a Video?

Summary

This text will be hidden

can you show where your waypoint is located at

show us the position of your waypoint

what is the floor material is it ice?

its salt, but this same thing happens to other materials like plastic and sand

can you show your second waypoint

do you have barries? because as I know almost all games do have them

I do not, assuming you mean barriers

ye try to add barriers for the path

I mean I’d recommend using tweenservice for that. That way it can’t slide off the path.

This is not path finding. You already defined the path, so all you need to do is move each humanoid to the next waypoint, and ensure they have reached the waypoint, unless they died. Take a look at this post with the same problem: Help with NPC pathfinding

1 Like

Among other things I realised I had massless on, so that was the main reason why it was sliding, they still go slightly off course but its alright, thanks to everyone

If you make the humanoid’s root part heavier, or with more friction, maybe the inaccuracy would stop.

How do I increase its weight?.. I have never seen that option before

It’s in CustomPhysicalProperties. There, there is an option to change density, friction, and bounciness (elasticity).

1 Like

That helped a lot, thanks so much!

1 Like