facing angle. -
Re: facing angle. -
AW: facing angle. -
He simply didn't knew that the function atan2 existed therefor he discerns all 4 sectors
pawn Code:
stock Float: GetZAngleBetweenPoints(Float: x1, Float: y1, Float: x2, Float: y2) {
return -atan2(x2 - x1, y2 - y1);
}
pawn Code:
stock SetPlayerLookAtPlayer(playerid, giveplayerid) {
new
Float: pX,
Float: pY,
Float: gX,
Float: gY,
Float: Z,
;
return
GetPlayerPos(playerid, pX, pY, Z) &&
GetPlayerPos(giveplayerid, gX, gY, Z) &&
SetPlayerFacingAngle(playerid, GetZAngleBetweenPoints(pX, pY, gX, gY))
;
}
Re: facing angle. -