I seek the truth about the directions in Minecraft

Discussion in 'Plugin Development' started by Ribesg, Nov 11, 2011.

Thread Status:
Not open for further replies.
  1. Hi
    Now I want to know. Where is what ?
    The Yaw value is between 0 and 360, right ?
    Yaw = 0 means ?
    I found somewhere that Yaw=0 means that the player is looking in direction Z-, other sources says that it's Z+...
    My question is :
    - What's the relation between YAW value, Z+/Z-/X+/X- and North/South/East/West ?

    Thanks

    http://mc.kev009.com/wiki/images/1/1e/Minecraft-trig-yaw.png Yaw value
    "Map have east at top" => So East = Z+ ?
    Sun, Clouds direction... I'm lost.
     
  2. Offline

    c0mp

    Clouds always move North, use that and F3 to orient yourself.
     
  3. Thank you, but what about the Yaw value ?
    Their should be a relation between the f value in the F3 screen and the yaw value ?
     
  4. Offline

    c0mp

    I'm pretty sure one of them is the yaw value.
     
  5. Just red the source of CommandBook.
    Code:java
    1.  
    2. public static String getCardinalDirection(Player player) {
    3. double rot = (player.getLocation().getYaw() - 90) % 360;
    4. if (rot < 0) {
    5. rot += 360.0;
    6. }
    7. return getDirection(rot);
    8. }
    9.  
    10. /**
    11.   * Converts a rotation to a cardinal direction name.
    12.   *
    13.   * @param rot
    14.   * @return
    15.   */
    16. private static String getDirection(double rot) {
    17. if (0 <= rot && rot < 22.5) {
    18. return "North";
    19. } else if (22.5 <= rot && rot < 67.5) {
    20. return "Northeast";
    21. } else if (67.5 <= rot && rot < 112.5) {
    22. return "East";
    23. } else if (112.5 <= rot && rot < 157.5) {
    24. return "Southeast";
    25. } else if (157.5 <= rot && rot < 202.5) {
    26. return "South";
    27. } else if (202.5 <= rot && rot < 247.5) {
    28. return "Southwest";
    29. } else if (247.5 <= rot && rot < 292.5) {
    30. return "West";
    31. } else if (292.5 <= rot && rot < 337.5) {
    32. return "Northwest";
    33. } else if (337.5 <= rot && rot < 360.0) {
    34. return "North";
    35. } else {
    36. return null;
    37. }
    38. }

    This answer my question.
     
Thread Status:
Not open for further replies.

Share This Page