An Arrow to a Point
#1

Hello guys,
I search for a script where i can let point an Arrow to a Point like this:


[ame]http://www.youtube.com/watch?v=AOxeFu38_5g&feature=player_embedded[/ame]
Reply
#2

have a look at the atan2 function:
pawn Code:
new Float:Angle=-(90+(atan2(YA-YB,XA-XB)));
all you need is the offset between both locations (x and y axis, the height can be ignored i guess). to get the offset, simply subtract x2 from x1, and y2 from y1. then apply the atan2 function with those 2 offsets. it will return an euler angle. idk if its a good advice to simply remove the -90 degrees in that formula, but feel free to experiment with it. this version takes the z-axis flipping relation betwen a player and objects (left/right handed) into account, thats why iam sure it could work for you
Reply
#3

I test it but thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)