I have a hard time trying to calculate a value to determine what direction an entity is moving towards at.
Currently, I have 2 points known at any point in time, the starting point and the ending point. The unit moves at a constant speed in a linear interpolating fashion. I'm trying to find what direction the entity is moving from the starting point to the ending point, not the other way around.
Example: If the starting point is at the point of origin in the Cartesian plane, and the ending point is at (10.1235, 0.81235), the direction the entity is moving towards at is east, since the angle is less than 45 degrees of northeast direction. In this case, after calculating the value (that I have a hard time trying), using conditional ifs, we can conclude that the direction east is determined.
Any tips I can use? I'm looking at Math.atan2(dy,dx), but maybe I may have been looking at it incorrectly. Thanks in advance.