Help Making Pathfinding

So i need to make a simple pathfinding system so my zombies and humans wont just hump a wall until they get in and will instead follow along the wall until theres a door or an empty space to go in. I was thinking of how to execute it im just unsure of how to make it move there. So my ideas were that its spawns invisible cubes around itself and if spawned in a wall itll say that spots not available to the npc or make it simpler with raycasting, But i dont know hot to execute its movement afterwards… or how to execute any of it at all… and also dont wanna mess up the script to much.

Heres the game Flowlab Game Creator - New Game

Note: Zombies break the fence just wait

Use raycasts to detect if an object is in front and quickly figure out using raycasts in 90, 180, 270, and 0 degrees so that it can find a movement path. It will be slightly random but good. Movement is the easiest part.

1 Like

Ya that doesnt suit my needs. My movement system isnt suited for that

i have a detect proximity code that might work…? it basically tells if you are close enough to smth

Well as that might help i need to get it to trace the wall and follow it till theres an opening

Proximity doesn’t give accurate enough results, but it would work with an angleto bundle to find an angle, just you’d need to do a lot of unnecessary work.

1 Like

That’s what raycasting does?

1 Like

Yeah, I have a race AI that won’t go into walls. It uses ray casts to know if it’s close enough to the walls to turn away. Just hook those ray casts up to switches to make it so they won’t turn in that direction as long as the ray hits the wall.