[Question] Get angle XYZ between points
#1

Question: Get angle XYZ between points

Given: There are 2 points:
Код:
Float:p1[3]; //player
Float:p2[3]; //arrow
My working example for calculating the angleZ (horizontal):
PHP код:
stock Float:GetAngleZFromPoints(Float:x1Float:y1Float:x2Float:y2) {
    return (
180.0 atan2(x1-x2y1-y2));

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:
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])));

Reply


Messages In This Thread
[Question] Get angle XYZ between points - by Logofero - 16.05.2015, 08:43
Re: [Question] Get angle XYZ between points - by iggy1 - 16.05.2015, 08:59
Re: [Question] Get angle XYZ between points - by Logofero - 16.05.2015, 09:32
Re: [Question] Get angle XYZ between points - by Logofero - 16.05.2015, 10:24

Forum Jump:


Users browsing this thread: 1 Guest(s)