Spider Wall Movement Between Waypoints

I’d like to make a script where an object walks between 2 waypoints and will travel between them in the manor described by the given picture.

I’ve tried various things using raycasts but they never work properly.

The world I’m working in is a sidescroller in 3D space. (So it only uses x and y coordinates)

I would just add more waypoints, one at each of the bends, The spider doesn’t have to stop at them but when hits them gets the info to travel to the next.I really don’t see any other way without complex coding instructing it to move so much -y, so much in x, then so much in y again etc etc.That’s kind of the purpose of waypoints to establish markers that when the object reaches them they receive new instructions. Just have the instructions be to go to the next. I have enemies patrolling all over my map walking down one street, hitting a waypoint and turning to go to the next