I've got 2 points (ie. X,Y vectors), and I need to find out the angle (degrees°) between them, so I can move an object which is at one of the points towards the other point.
How do I calculate the degrees plz???
Name:
noobular2008-11-17 8:02
WAIT NO
It doesn't work when the target vector is to the left of my current position vector.
/** Move ()
*
* Move the object towards its vector.
*
*/
void Object_t::Move()
{
Velocity.x = thrust * cos(headingDegs);
Velocity.y = thrust * sin(headingDegs);
Vector += Velocity;
}
/** GetDegrees ()
*
* Set headingDegs based on Target vector.
*
*/
void Object_t::GetDegrees()
{
float dx, dy;
if (Target.y > Vector.y)
dy = Target.y - Vector.y;
else
dy = Vector.y - Target.y;