Suggestion Camera rotation angle

Discussion in 'Client & Site Suggestions' started by Savior, Dec 20, 2014.

  1. In the case that a randomly chosen angle is more than 359 or less than 0, instead of throwing an illegal argument exception, please add something like this:

    Code (Text):
    1. public static boolean setYaw(final int a) {
    2.     int b = a;
    3.     while (b < 0 || b > 359) {
    4.         b += b < 0 ? 359 : -359;
    5.     }
    6. }

    Then use b for the angle.
  2. Not sure I like that. The responsibility for doing the arithmetic (which would be better done as "a % 360") is on the bot author. It's highly improper to setYaw(732) for example. I'll let @Cloud see what he thinks as well.
    dog_ likes this.
  3. "In the case that a randomly chosen angle"
    By saying that I meant like when you add a kind of deviation to your current angle and move to this new value.
    But modulo is indeed a better implementation, I didn't thought of that while writing the topic
  4. You can add all the deviation you want as long as you ensure it is within certain bounds [0, 359] before passing it to the setYaw method. I would recommend using recursion or a simple while loop that checks to make sure it complies.

    P.S. Or just using the modulus hack lol.
  5. Thats what im using currently :)
    This implemention is not very important to me, it would just make things easier to read and to use...

Share This Page