• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

Trigonometry Question

Status
Not open for further replies.
Level 11
Joined
Jan 23, 2015
Messages
788
Okay, I suck at math! I've learned a few things with War3 WE, but it's still not enough..

So, when I use the angle of two points for something, the max angle is 180, and when it passes 180 it returns 0.. How do I make the max angle 360 degrees?
 
Level 29
Joined
Sep 26, 2009
Messages
2,564
The function "angle between points" returns an angle in the interval (-180, 180], it basically looks like this:
Code:
          90
     135   |   45
180     -------      0
    -135   |  -45
         -90

Now the option here is to either use a sin/cos function which will convert it back and forth or do it manually by using calculation:
result = (angle + 360) % 360
Example inputs and outputs:
-180 + 360 = 180 ... 180 % 360 = 180.
90 + 360 = 450 ... 450 % 360 = 90

The % (modulo) operation gives as a result the remainder after diving one number by another. So the remainder in the calculation 450/360 is 90 - and that's the output of the modulo operation.
 
Status
Not open for further replies.
Top