Botre Posted March 22, 2015 Posted March 22, 2015 (edited) Quickly wrote this, feel free to improve! Precision: 45° You could probably calculate the angle much more precisely, I'll maybe give that a shot another time ^^ public static boolean isCharacterFacing(Character<?> character, Position position) { int rotation = character.getRotation(); Position charPos = character.getPosition(); int xDiff = charPos.getX() - position.getX(); int yDiff = charPos.getY() - position.getY(); // Character position equals position. if (xDiff == 0 && yDiff == 0) { return false; } // Position is east of character. if (xDiff < 0) { if (rotation < 1024) { return false; } } // Position is west of character. else if (xDiff > 0) { if (rotation > 1024) { return false; } } // Position is on the same vertical axis. else { // Position is exactly south of character. if (yDiff > 0) { return rotation < 256 || rotation > 1792; } // Position is exactly north of character. else { return rotation > 762 && rotation < 1286; } } // Position is south of character. if (yDiff > 0) { if (rotation > 512 && rotation < 1536) { return false; } } // Position is north of character. else if (yDiff < 0) { if (rotation < 512 || rotation > 1536) { return false; } } // Position is on the same horizontal axis. else { // Position is exactly east of character. if (xDiff < 0) { return rotation > 1286 && rotation < 1792; } // Position is exactly west of character. else { return rotation > 256 && rotation < 762; } } return true; } public static boolean isCharacterFacing(Character<?> character, RS2Object object) { return isCharacterFacing(character, object.getPosition()); } Edited March 22, 2015 by Botre 2