A* Pathfinding Project

Raycast Modifier is Bent


#1


#2

Hi

You have the modifier’s layer mask set to Everything. That will also include the agent itself since it has a circle collider. I would recommend that you change the layer mask to exclude the agent’s own layer.

Also. Graph raycasting instead of physics raycasting is usually faster and more predictable. So if you don’t need physics raycasting specifically I would recommend that you use graph raycsting instead.


#3

cool thanks, the problem with Graph Raycaster is that it loves to cut corners, this kind of makes the path feel less smooth, also, if i change the collider type to circle, the pathfinding kind of breaks when there is one space in between two walls that the object should be able to fit through.
image

It would be great if i can add a check to the graph raycast so that it would check either of the 2 adjacent squares of potential diagonal path to see if it blocked, and if it is, follow the path as-is instead of trying to cut through it.


#4

Hi

Graph raycasting does not have a thickness (it’s a bit tricky to support), but you could use Physics (2D) raycasting which does have a thickness.

You could also try to use the SimpleSmoothModifier with the smoothing set to the Curved Nonuniform mode (I think that one will work best for this use case at least).