I remember encountering this problem in college, but we did not use the A * search. I cannot remember the exact details of mathematics, but I can give you the basic idea. Perhaps someone else might be more detailed.
We are going to create a potential field from your playing area with which the object can follow.
Now imagine your object as marble. If you placed it at the starting point, it should slide down the playing field, around obstacles and hit the target.
The hard part, the math I donβt remember, is the equations that represent each of these blows and wells. If you notice this, add them together to get your final field, then do some vector computation to find the gradient (just like towi said), and the direction you want to go at any stage. Hopefully this method will be fast enough so that you can recount it at every step, as your obstacles move.
source share