16.05.2015, 08:43
(
Последний раз редактировалось Logofero; 16.05.2015 в 10:36.
Причина: Edited Decided
)
Question: Get angle XYZ between points
Given: There are 2 points:
My working example for calculating the angleZ (horizontal):
Q: How to get a calculation for vertical angle?
Method found. Thanks iggy1 http://forum.sa-mp.com/showthread.ph...67#post2625467
Get angleY (vertical) between points:
Given: There are 2 points:
Код:
Float:p1[3]; //player Float:p2[3]; //arrow
PHP код:
stock Float:GetAngleZFromPoints(Float:x1, Float:y1, Float:x2, Float:y2) {
return (180.0 - atan2(x1-x2, y1-y2));
}
Method found. Thanks iggy1 http://forum.sa-mp.com/showthread.ph...67#post2625467
Get angleY (vertical) between points:
PHP код:
stock Float:GetAngleYFromPoints(Float:p1[3], Float:p2[3]) {
p1[0] -= p2[0]; //x
p1[1] -= p2[1]; //y
return (360.0 - atan((p1[2]-p2[2])/floatsqroot(p1[0]*p1[0]+p1[1]*p1[1])));
}