Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - electrux

Pages: [1]
1
Graphics / Angle between 2 points
« on: August 21, 2014, 08:08:32 am »
Hello everyone,
i am trying to get the angle between 2 points (1 of player and other of mouse).
i use this:

float getangle(float _x1,float _y1, float _x2, float _y2) // x1 and y1 are pos of mouse and x2 and y2 are pos of player
{
   float _ang, _pi = 3.1428;
   _ang = atan2(_y2 - _y1,_x2 - _x1) * (180/_pi);
   return _ang;
}

but it only gives me 4rth quadrant angle about 45 degree.
i saw another topic about it but was unable to understand... please help  :(

Pages: [1]
anything