SA-MP Forums Archive
asin. acos, atan, atan2 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: asin. acos, atan, atan2 (/showthread.php?tid=103946)



asin. acos, atan, atan2 - Kovacs_Richard - 21.10.2009

Код:
if(strcmp(cmd, "/position", true) == 0 || strcmp(cmd, "/pos", true) == 0)
	{
	  new Float:px,Float:py,Float:pz,Float:pa,pi,pw;
	  GetPlayerPos(playerid,px,py,pz);
	  GetPlayerFacingAngle(playerid,pa);
	  pi = GetPlayerInterior(playerid);
	  pw = GetPlayerVirtualWorld(playerid);
	  if(PlayerInfo[playerid][pLanguage] == 0)
		{
	  	format(string, sizeof(string), "Position: %.4f,%.4f,%.4f %.4f | INT: %d | VirtualWorld %d", px,py,pz,pa,pi,pw);
      SendClientMessage(playerid,COLOR_YELLOW,string);
			format(string, sizeof(string), "TG-: %.4f | TG: %.4f", atan(360-pa),atan(pa));
			SendClientMessage(playerid,COLOR_YELLOW,string);

		}
		if(PlayerInfo[playerid][pLanguage] == 1)
		{
	  	format(string, sizeof(string), "Pozнciуd: %.4f,%.4f,%.4f %.4f | INT: %d | Virtuбlis Vilбg %d", px,py,pz,pa,pi,pw);
      SendClientMessage(playerid,COLOR_YELLOW,string);
      new Float:tng = asin(pa)/acos(pa);
			format(string, sizeof(string), "TG-: %.4f | TG: %.4f | TG: %.4f | Sin: %.4f | Cos: %.4f | Tan2: %.4f", atan(360-pa),atan(pa),tng,asin(pa),acos(pa),atan2(px,py));
			SendClientMessage(playerid,COLOR_YELLOW,string);
		}
	  return 1;
	}
when i spawn i can get asin and acos but when i move(d) i cant get these...
and the atan is working? myrot is 55 and the atan is 88.9583 and the tan ( in calculator ) is 1.42...
atan2 is working well

pls check these functions...


Re: asin. acos, atan, atan2 - Mike - 17.11.2009

atan(55) = ~88.96 degrees, that's correct. I don't see the problem.