2D Pathfinding near the wall

Hi, does anyone knows how to make a 2D pathfinding on a platformer tilemap for a spider that can climb walls? Thanks a lot!

This looks like perhaps what you want is more of an edge-follower type approach, an agent that can go left or right along a 2D “edge” (ie., ceiling / wall / floor of rock vs the air), and navigate it successfully.

The simplest way code-wise is to just draw a spline along the edge of the ground/air interface and follow that spline.

A more code-intensive approach would be to make an agent that uses something like raycasting or checking for rock / air ahead of them, and moves and adjusts their orientation to follow the plane of the ground.

I’m sure there are other approaches, but those are the two most obvious that come to mind.

1 Like

Thank You a lot, but I am not sure how to draw a spline when the map is proceduraly generated. Do you have any suggestion? Thank You again sir.

Sounds like you will need option 2 above. You want an agent that follows an edge. The simplest would be something that has two “feelers”, perhaps done with raycasting, kind of like a letter A sliding laterally along uneven ground.

The feelers would be the legs of the A going out, and wherever they hit the ground would define the new slope of the ground you want to follow, and you would turn the agent in that direction before moving it.

1 Like

Tkans a lot!!