Posts: 155
Threads: 52
Joined: Apr 2009
Reputation:
0
Hey,
I created a command that summon some pet, which can attack
/attack [id]
if the object is in some distance from the player, he will lose HP.
but i've a problem with the rotation, how can i set the rotation of the object like the rotation of the target?
thanks.
Posts: 32
Threads: 12
Joined: Apr 2010
Reputation:
0
Maybe making something with GetPlayerFacingAngle and SetObjectRot
Posts: 4,878
Threads: 85
Joined: Jun 2007
Reputation:
0
Its a small hand full math.
By default, the rotation the pet has to have can be calculated like this:
a: the y-coord difference of the pos of the object and the target
b: the x-coord difference
c: sqare root (aІ + bІ)
rotation of object = arcsin (a / c)
So: get the position of object and target and transcribe this to pawn, in one or more lines (arcsin = asin in pawn)
Edit: You also have to add something (180 i think) to the calculated rotation for samp
Posts: 155
Threads: 52
Joined: Apr 2009
Reputation:
0
10.07.2010, 06:37
(
Последний раз редактировалось borisblat; 10.07.2010 в 08:44.
)
aaaaaaaa
lol thanks..
i didn't understand where do i put the sin and the 180 degrees?
thanks
Posts: 155
Threads: 52
Joined: Apr 2009
Reputation:
0
UP*
sorry for double post if it's not allowed