• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

calculating distance using the trigonometric functions?

Status
Not open for further replies.
Level 4
Joined
May 17, 2005
Messages
94
not sure, but it seems to me youd have to set a point matching the x value of 1 point and the y value of the other point to make a triangle and then use an x-x kind of thing to detect 1 of the distances of 1 of the sides and then use sin/cos functions to make it detect distance.

but my mind isnt working right now, so if any1 could explain how to make the trigger...pls :(
 
Level 12
Joined
Apr 29, 2005
Messages
999
I don't understand what your after but here is a trigonometic formla for distance if you know the X1 , X2, Y1 and Y2.

(Y2-Y1)/sin(Atan((Y2-Y1) - (X2-X1))
It calculates the C line in a triangle like Pytagars's formula, without square root. However this formula is much slower than Pytagora's so don't use it. I just made it to see if it was faster but it wasn't.
 
Status
Not open for further replies.
Top