Rotation between two points
#2

I've figured it out for 2D coordinates (X,Y) but not yet for 3D coordinates (X,Y,Z)

pawn Код:
Float:GetAngleBetweenPoints(Float:X1,Float:Y1,Float:X2,Float:Y2)
{
  new Float:angle=atan2(X2-X1,Y2-Y1);
  if(angle>360)angle-=360;
  if(angle<0)angle+=360;
  return angle;
}
I once used it to make an in-game compass that pointed out nearby players and the user's objective.


looked like this (if player was looking straight North)
|||||||||N|||||||||
|=player
|=objective
Reply


Messages In This Thread
Rotation between two points - by ev0lution - 02.04.2010, 02:37
Re: Rotation between two points - by Joe Staff - 02.04.2010, 04:15
Re: Rotation between two points - by ev0lution - 02.04.2010, 04:17
Re: Rotation between two points - by Joe Staff - 02.04.2010, 04:19
Re: Rotation between two points - by ev0lution - 02.04.2010, 04:24
Re: Rotation between two points - by ev0lution - 02.04.2010, 22:01
Re: Rotation between two points - by ev0lution - 04.04.2010, 00:15

Forum Jump:


Users browsing this thread: 1 Guest(s)