# libgdx FollowPath proper usage

I have a path (picture 1), in this case 2 points - corner and target.
Pic.1
Then I try to make the character move (passing my path to libgdx FollowPath Steering Behavior).

private FollowPath<Vector2, LinePathParam> followp= new FollowPath<Vector2, LinePathParam>(this, new LinePath<Vector2>(astar.findPath(position, target)),0f,0f);


(astar.findPath(position, target) - function that returns Array of points(path). Experimenting with 3rd and 4th parameters (passOffset and predictionTime) made it worse.) And it gains such result (purple line on Picture 2).

Pic.2
But how can I get such result (green line on Picture 3)?
Pic.3

• What result do you get when you use the default constructor? FollowPath(Steerable<T> owner, Path<T,P> path) What kind of graph do you use? Are you sure the returned path is correct? – nathan Oct 6 '15 at 8:36
• @nathan, default constructor - same result. Path is correct. Kind of graph... what do you mean? – Andrei Yusupau Oct 6 '15 at 10:31

## Solution

So, as you can see, the green line seems to bend toward the normal then bend away again toward the final position. To do this, we can use two LibGDX Circle instances with the same radii - being large enough for the first point at the turn's edge to be where you want the turning to start.
Well, I've talked about moving on an angle but how do we achieve this? Simple really, (I'm in 9th grade / Year 10 and I know this) we use the equation of the line or y=m*x+c in which y represents the Y coordinate on the screen depending on the gradient m and starting at the intercept c but this is basic straight-line graph calculus and this has 2 turns. Assuming we go by the calculus rules of dimensional naming conventions, 1D = straight-line, 2D = quadratic, 3D = cubic etc., then this would be a cubic function graph since there are 3 different line equations but to do cubic function graphs. I'm not sure of those but here's a link: Click me!