Making an object face a certain point
#3

R = GetPlayerDistanceFromPoint
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)
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:
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.

So once you have 'a', use the above mentioned conversion.
Reply


Messages In This Thread
Making an object face a certain point - by SuperViper - 21.07.2012, 18:11
Re: Making an object face a certain point - by MerryDeer - 14.10.2016, 16:07
Re: Making an object face a certain point - by Freaksken - 14.10.2016, 18:14
Re: Making an object face a certain point - by MerryDeer - 14.10.2016, 19:36
Re: Making an object face a certain point - by Logic_ - 14.10.2016, 19:39
Re: Making an object face a certain point - by Freaksken - 14.10.2016, 19:41
Re: Making an object face a certain point - by MerryDeer - 14.10.2016, 20:17
Re: Making an object face a certain point - by MerryDeer - 15.10.2016, 06:01
Re: Making an object face a certain point - by CoBra22 - 15.10.2016, 08:27
Re: Making an object face a certain point - by Freaksken - 15.10.2016, 21:58

Forum Jump:


Users browsing this thread: 2 Guest(s)