Skip to content

Commit

Permalink
update "forward" to match modern yaw
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Bilbrey authored and TomyLobo committed Dec 2, 2012
1 parent 5e1836a commit ab693a7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/main/java/com/sk89q/worldedit/LocalPlayer.java
Expand Up @@ -374,7 +374,7 @@ public PlayerDirection getCardinalDirection(int yawOffset) {
}

// From hey0's code
double rot = (getYaw() + yawOffset - 90) % 360;
double rot = (getYaw() + yawOffset) % 360; //let's use real yaw now
if (rot < 0) {
rot += 360.0;
}
Expand All @@ -389,23 +389,23 @@ public PlayerDirection getCardinalDirection(int yawOffset) {
*/
private static PlayerDirection getDirection(double rot) {
if (0 <= rot && rot < 22.5) {
return PlayerDirection.NORTH;
return PlayerDirection.SOUTH;
} else if (22.5 <= rot && rot < 67.5) {
return PlayerDirection.NORTH_EAST;
return PlayerDirection.SOUTH_WEST;
} else if (67.5 <= rot && rot < 112.5) {
return PlayerDirection.EAST;
return PlayerDirection.WEST;
} else if (112.5 <= rot && rot < 157.5) {
return PlayerDirection.SOUTH_EAST;
return PlayerDirection.NORTH_WEST;
} else if (157.5 <= rot && rot < 202.5) {
return PlayerDirection.SOUTH;
return PlayerDirection.NORTH;
} else if (202.5 <= rot && rot < 247.5) {
return PlayerDirection.SOUTH_WEST;
return PlayerDirection.NORTH_EAST;
} else if (247.5 <= rot && rot < 292.5) {
return PlayerDirection.WEST;
return PlayerDirection.EAST;
} else if (292.5 <= rot && rot < 337.5) {
return PlayerDirection.NORTH_WEST;
return PlayerDirection.SOUTH_EAST;
} else if (337.5 <= rot && rot < 360.0) {
return PlayerDirection.NORTH;
return PlayerDirection.SOUTH;
} else {
return null;
}
Expand Down

0 comments on commit ab693a7

Please sign in to comment.