[Help] Following Objects
#1

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.
Reply
#2

Maybe making something with GetPlayerFacingAngle and SetObjectRot
Reply
#3

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
Reply
#4

aaaaaaaa
lol thanks..

i didn't understand where do i put the sin and the 180 degrees?
thanks
Reply
#5

UP*
sorry for double post if it's not allowed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)