Problem with astar pathfinding

Hi there,

I want to build a movement system like the Spy Mouse. Which means I want to make a navgation like the pic following.

35439-1.pic.jpg

The red line is a wall. The yellow arrow is the astar pathfind way, but I want the greed point move follow the blue arrow and stop in the origin side of the wall like that.

Can you guys help me solve this problem? Thx very much!

It looks to me like this is not a pathfinding algorithm as such (or, at least, not a very good one since it doesn’t reach the intended target!).

From your diagram, the blue line appears to just be the straight line vector from the start point to the target. On every frame, calculate this vector and apply a force that attempts to move in that direction. Assuming that the red line has a collider on it, hitting this will automatically prevent movement in the y axis, but the x component will continue to be resolved until the object comes to rest at the green spot shown.