# Pathfinding Bridge Scenarios

Hi

Currently, I’m trying to do a custom pathfinding system for zombies.
Let me explain the certain mechanic of my pathfinding:
If the zombie sees the player in plain sight, it doesn’t have to pathfind and just runs towards the player.

The issue:
In places where it involves getting across one platform to another, using via bridge or whatever, the zombie would see the player in sight on the other side of the platform and chase after the player but without knowing it’ll fall off to its death. And also in parkour situations, when the player decides to jump off something (from a place where it’s not too high to cause fall damage), the zombie would take a way longer route instead of jumping off to chase after the player despite it being safe. This is something I do not know how to do.

Here’s an image:
(Blue is what the zombie should be moving alongslide to reach the static target)
(Red is a no-no thing where the zombie runs straight and falls)
(Black is when the static target moves and jumps down)
(Green is where the zombie reacts and jumps down to chase after the target, which is supposed to happen)

2 Likes

TL;DR:
How to detect an upcoming fall in a straight path

3 Likes

Why not use the pathfinding service for all scenarios?, but if I understand correctly if you wanted to detect if an npc is going to fall one way you could do it is attach a part in front of the npc and attach another part steming downward from that part, then simply check if that part is touching anything, if so tell the npc to walk forward. Hopefully this was helpful in some way!

1 Like

Although I personally would not like using parts as detectors, your response definately gave me an idea on how to do it.

I have 2 ways:

1. Get the distance between the player and zombie, then run a for loop based on the distance value and scan through the raycast line facing the opposite of UpVector and check if it is steeper than the size of the character and its jump height.

2. Run through an arc (idk which one: sine, cosine or tangent) scanning from bottom to middle from the head and check the steepness of that position (this one prob harder idk im typing this on my phone)

2 Likes