SoulSplitz Posted June 13, 2018 Share Posted June 13, 2018 (edited) I was looking to some snippets and found a camera system from @Lemons and there is that thing which confused me.. Here are the functions implementation of moving the current angel of the camera to a specific position/direction public void moveNorth() { int r = Script.random(0, 30); if (r > 15) r = 375 - r; moveYaw(r); } public void moveWest() { moveYaw(75 + Script.random(0, 30)); } public void moveSouth() { moveYaw(165 + Script.random(0, 30)); } public void moveEast() { moveYaw(255 + Script.random(0, 30)); } And I was trying to write functions to check where the camera direction is and came up with the following: public boolean isNorth() { return (getYawAngle() >= 0 && getYawAngle() < 75) || getYawAngle() == 360; } public boolean isWest() { return getYawAngle() >= 75 && getYawAngle() < 165; } public boolean isSouth() { return getYawAngle() >= 165 && getYawAngle() < 255; } public boolean isEast() { return getYawAngle() >= 255 && getYawAngle() < 360; } It is a little bit strange to me because it should be north, east, south, and west and the angels should be 0-90, 90-180, 180-270, 270-360 However, it seems to be counterclockwise and 0-90 would include both east and north https://www.mathsisfun.com/geometry/images/degrees-360.gif In this case, north should be -75-75 not 0-75 but someone seems to have defined it that way and it looks rather arbitrary. (Might be the absolute value of that range, as Zappster told me from chats). My question is "why's this thing like that?" Is it because the developer made it that way? Another question is.. Why when checking west, the range is 75-165 but when moving to west, the range is 75 + 0,30 which could maximally reach 105? In addition, could someone help me write a function to check the north-east or south-west direction then? Edited June 14, 2018 by SoulSplitz Typo 1 Quote Link to comment Share on other sites More sharing options...
Alek Posted June 14, 2018 Share Posted June 14, 2018 https://www.mathsisfun.com/algebra/trig-interactive-unit-circle.html Play around with this. Edit: My mistake it looks like you already did some research, I'll toy around with it this weekend. Im sure there's some sort of reason. 1 Quote Link to comment Share on other sites More sharing options...