Class Camera


  • public class Camera
    extends java.lang.Object
    Created by Nezz
    • Method Detail

      • getCameraMode

        public static CameraMode getCameraMode()
        Returns the current camera mode, showing how the client will move the camera by default
        Returns:
        Camera mode, the default of which is CameraMode.MOUSE_OR_KEYBOARD which chooses randomly when moving the camera
      • setCameraMode

        public static void setCameraMode​(CameraMode mode)
        Parameters:
        mode - Camera
      • getPitch

        public static int getPitch()
        Gets the pitch of the camera
        Returns:
        value of the pitch
      • getYaw

        public static int getYaw()
        Gets the yaw of the camera
        Returns:
        value of the yaw
      • getX

        public static int getX()
        Gets the X of the camera
        Returns:
        value of the camera X
      • getY

        public static int getY()
        Gets the Y of the camera
        Returns:
        value of the camera Y
      • getZ

        public static int getZ()
        Gets the Z of the camera
        Returns:
        value of the camera Z
      • getZoom

        public static int getZoom()
        Gets the camera's current zoom level
        Returns:
        Zoom level from about 330 (zoomed all the way out) to about 3000 (zoomed all the way in) Note: minimum and maximum zoom levels depend on your position in game
      • getLowestPitch

        public static int getLowestPitch()
        Gets the lowest availble pitch Recently updated to just be a flat 128
        Returns:
        128 constant
      • firePitchAndYawEvent

        public static void firePitchAndYawEvent​(int pitch,
                                                int yaw)
        Fires the RuneScriptEvent to change camera pitch/yaw Does not verify your inputs
        Parameters:
        pitch - desired pitch
        yaw - desired yaw
      • fireZoomEvent

        public static void fireZoomEvent​(int zoom)
        Fires the RuneScriptEvent to change camera zoom Does not verify your inputs
        Parameters:
        zoom - desired zoom
      • setZoom

        public static boolean setZoom​(int zoomLevel)
        Sets the camera's zoom level using the scroll wheel
        Parameters:
        zoomLevel - The desired zoom level, from about 330 (zoomed all the way out) to about 3000 (zoomed all the way in) Note: minimum and maximum zoom levels depend on your position in game
        Returns:
        true if the final zoom level is within an acceptable margin, false otherwise
      • rotateToEntity

        public static boolean rotateToEntity​(Entity entity)
        Rotates the camera to face an entity
        Parameters:
        entity - entity to rotate camera to
        Returns:
        true if successfully rotated
      • rotateToEntity

        public static boolean rotateToEntity​(Entity entity,
                                             Condition interrupt)
        Rotates the camera to face an entity
        Parameters:
        entity - entity to rotate camera to
        Returns:
        true if successfully rotated
      • rotateToTile

        public static boolean rotateToTile​(Tile tile)
        Rotates the camera to face a tile
        Parameters:
        tile - tile to rotate camera to
        Returns:
        true if successfully rotated
      • rotateToTile

        public static boolean rotateToTile​(Tile tile,
                                           Condition interrupt)
        Rotates camera to face a tile
        Parameters:
        tile - Tile to rotate to
        interrupt - Condition to interrupt camera movement
        Returns:
        true if successfully rotated
      • rotateTo

        public static boolean rotateTo​(int yaw,
                                       int pitch)
        Rotates camera to a particular yaw and pitch
        Parameters:
        yaw - yaw to rotate to (this is left-right)
        pitch - pitch to rotate to (this is up-down)
        Returns:
        true if successfully rotated
      • rotateToYaw

        public static boolean rotateToYaw​(int yaw)
        Rotates camera yaw to specified angle
        Parameters:
        yaw - yaw to rotate to
        Returns:
        true if successfully rotated
      • rotateToPitch

        public static boolean rotateToPitch​(int pitch)
        Rotates camera pitch to specified angle
        Parameters:
        pitch - pitch to rotate to
        Returns:
        true if successfully rotated
      • mouseRotateToEntity

        public static boolean mouseRotateToEntity​(Entity entity)
        Rotates camera to face an entity by using the mouse scroll wheel
        Parameters:
        entity - entity to rotate camera to
        Returns:
        true if successfully rotated
      • mouseRotateToTile

        public static boolean mouseRotateToTile​(Tile tile)
        Rotates camera to face a tile by using the mouse scroll wheel
        Parameters:
        tile - tile to rotate camera to
        Returns:
        true if successfully rotated
      • mouseRotateTo

        public static boolean mouseRotateTo​(int yaw,
                                            int pitch)
        Rotates camera to a particular yaw and pitch using the mouse scroll wheel
        Parameters:
        yaw - yaw to rotate to (this is left-right)
        pitch - pitch to rotate to (this is up-down)
        Returns:
        true if successfully rotated
      • mouseRotateToYaw

        public static boolean mouseRotateToYaw​(int yaw)
        Rotates camera yaw to specified angle using the mouse scroll wheel
        Parameters:
        yaw - yaw to rotate to
        Returns:
        true if successfully rotated
      • mouseRotateToPitch

        public static boolean mouseRotateToPitch​(int pitch)
        Rotates camera pitch to specified angle using the mouse scroll wheel
        Parameters:
        pitch - pitch to rotate to
        Returns:
        true if successfully rotated
      • keyboardRotateToEntity

        public static boolean keyboardRotateToEntity​(Entity entity)
        Rotates camera to face an entity by using the keyboard
        Parameters:
        entity - entity to rotate camera to
        Returns:
        true if successfully rotated
      • keyboardRotateToTile

        public static boolean keyboardRotateToTile​(Tile tile)
        Rotates camera to face a tile by using the keyboard
        Parameters:
        tile - tile to rotate camera to
        Returns:
        true if successfully rotated
      • keyboardRotateTo

        public static boolean keyboardRotateTo​(int yaw,
                                               int pitch)
        Rotates camera to a particular yaw and pitch using the keyboard
        Parameters:
        yaw - yaw to rotate to (this is left-right)
        pitch - pitch to rotate to (this is up-down)
        Returns:
        true if successfully rotated
      • keyboardRotateToYaw

        public static boolean keyboardRotateToYaw​(int yaw)
        Rotates camera yaw to specified angle using the keyboard
        Parameters:
        yaw - yaw to rotate to
        Returns:
        true if successfully rotated
      • keyboardRotateToPitch

        public static boolean keyboardRotateToPitch​(int pitch)
        Rotates camera pitch to specified angle using the keyboard
        Parameters:
        pitch - pitch to rotate to
        Returns:
        true if successfully rotated
      • rotateToEntityEvent

        public static CameraEvent rotateToEntityEvent​(Entity entity)
        Generates and runs a CameraEvent to rotate camera to specified entity
        Parameters:
        entity - entity to rotate camera to
        Returns:
        CameraEvent
      • rotateToTileEvent

        public static CameraEvent rotateToTileEvent​(Tile tile)
        Generates and runs a CameraEvent to rotate camera to specified tile
        Parameters:
        tile - tile to rotate camera to
        Returns:
        true if successfully rotated
      • rotateToEvent

        public static CameraEvent rotateToEvent​(int yaw,
                                                int pitch)
        Generates and runs a CameraEvent to rotate camera to specified yaw and pitch
        Parameters:
        yaw - yaw to rotate camera to
        pitch - pitch to rotate camera to
        Returns:
        CameraEvent
      • rotateToYawEvent

        public static CameraEvent rotateToYawEvent​(int yaw)
        Generates and runs a CameraEvent to rotate camera to specified yaw
        Parameters:
        yaw - to rotate camera to
        Returns:
        CameraEvent
      • rotateToPitchEvent

        public static CameraEvent rotateToPitchEvent​(int pitch)
        Generates and runs a CameraEvent to rotate camera to specified pitch
        Parameters:
        pitch - pitch to rotate camera to
        Returns:
        CameraEvent
      • getYawForTile

        public static int getYawForTile​(Tile tile)
        Gets the yaw required to view the given tile
        Parameters:
        tile - Tile to get yaw for
        Returns:
        Yaw required to be looking at the given tile, returns getYaw() if local player is null or tile is not local
      • getPitchForTile

        public static int getPitchForTile​(Tile tile)
        Gets the pitch required to look at the given Tile
        Parameters:
        tile - Tile to check pitch for
        Returns:
        Pitch required to be looking at the given tile, returns getPitch() if local player is null or tile is not local
      • getMaxZoom

        public static int getMaxZoom()
        Gets the maximum zoom value