Making an object face a certain point
#1

How would I go about making an object face a certain point? I need this for a new script I'm working on and I need the object to face the player.
Reply
#2

Yes me too
Reply
#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
#4

Give full function
Reply
#5

Make yourself, you have the formula -_-
Reply
#6

Quote:
Originally Posted by MerryDeer
Посмотреть сообщение
Give full function
Put in some effort.
Reply
#7

This is too hard for my
Reply
#8

And this formula is for coordinates? i need rotatations
Reply
#9

i know one man hes good scripter but he off atm
Reply
#10

Quote:
Originally Posted by MerryDeer
Посмотреть сообщение
And this formula is for coordinates? i need rotatations
That's why I said to rewrite the equation so you could get the rotation.
If you don't know how to rewrite the equation (which is just math), then search on ******.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)