14.10.2016, 18:14
R = GetPlayerDistanceFromPoint
X1 = player x
Y1 = player y
X0 = object x
Y0 = object y
A = the angle you want to get
Rewrite the equation to retrieve a. Then set the objects' z-rotation.
Edit:
The equation is for 2D btw. In other words, a = z rotation of the object. For more info, search: point on edge of circle, on ******.
If you need 3D, search for the following on ******: point on edge of sphere.
Keep in mind the strange angle system in gta sa:
So once you have 'a', use the above mentioned conversion.
X1 = player x
Y1 = player y
X0 = object x
Y0 = object y
A = the angle you want to get
Код:
x1 = x0 + r * cos(a) y1 = y0 + r * sin(a)
Edit:
The equation is for 2D btw. In other words, a = z rotation of the object. For more info, search: point on edge of circle, on ******.
If you need 3D, search for the following on ******: point on edge of sphere.
Keep in mind the strange angle system in gta sa:
Quote:
Angles are reversed in GTA:SA; 90 degrees would be East in the real world, but in GTA:SA 90 degrees is in fact West. North and South are still 0/360 and 180. To convert this, simply do 360 - angle. |