Generating heading from current point and end point

I can’t seem to figure out the math to generate a heading from a start and end point. Any help?

You can use the atan2 function to get the angle from one point to another

1 Like

the atan2 function calculates the arc tangent and adds some angle values depending on the sign of the change in x and change in y. tan(angle) = y/x so atan(y/x) = angle.

Here’s a desmos interactive I made that you can use. The main arctangent function is on the left-hand sidemenu. Rendering functions were put in the “other stuff for rendering” folder. You can drag the blue and red points.