Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Gets the Yaw from one location to another in relation to North.
- *
- */
- public double getYawTo(Location from, Location to) {
- final int distX = to.getBlockX() - from.getBlockX();
- final int distZ = to.getBlockZ() - from.getBlockZ();
- double degrees = Math.toDegrees(Math.atan2(distX, distZ)) - 90;
- if (degrees < 0) degrees += 360;
- degrees %= 360;
- return degrees;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement