[Help] Following Objects - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Following Objects (
/showthread.php?tid=158403)
[Help] Following Objects -
borisblat - 09.07.2010
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.
Re: [Help] Following Objects -
dovys11 - 09.07.2010
Maybe making something with GetPlayerFacingAngle and SetObjectRot
Re: [Help] Following Objects -
Mauzen - 09.07.2010
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
Re: [Help] Following Objects -
borisblat - 10.07.2010
aaaaaaaa
lol thanks..
i didn't understand where do i put the sin and the 180 degrees?
thanks
Re: [Help] Following Objects -
borisblat - 10.07.2010
UP*
sorry for double post if it's not allowed