Package rsb.methods

Class Camera


public class Camera extends MethodProvider
Camera related operations.
  • Method Details

    • turnToCharacter

      @Deprecated public void turnToCharacter(RSCharacter c)
      Deprecated.
      Turns to an RSCharacter (RSNPC or RSPlayer).
      Parameters:
      c - The RSCharacter to turn to.
    • turnTo

      public void turnTo(RSCharacter c)
      Turns to a RSCharacter (RSNPC or RSPlayer).
      Parameters:
      c - The RSCharacter to turn to.
    • turnToCharacter

      @Deprecated public void turnToCharacter(RSCharacter c, int dev)
      Deprecated.
      Turns to within a few degrees of an RSCharacter (RSNPC or RSPlayer).
      Parameters:
      c - The RSCharacter to turn to.
      dev - The maximum difference in the angle.
    • turnTo

      public void turnTo(RSCharacter c, int dev)
      Turns to within a few degrees of an RSCharacter (RSNPC or RSPlayer).
      Parameters:
      c - The RSCharacter to turn to.
      dev - The maximum difference in the angle.
    • turnToObject

      @Deprecated public void turnToObject(RSObject o)
      Deprecated.
      Turns to an RSObject
      Parameters:
      o - The RSObject to turn to.
    • turnTo

      public void turnTo(RSObject o)
      Turns to an RSObject.
      Parameters:
      o - The RSObject to turn to.
    • turnToObject

      @Deprecated public void turnToObject(RSObject o, int dev)
      Deprecated.
      Turns to within a few degrees of an RSObject.
      Parameters:
      o - The RSObject to turn to.
      dev - The maximum difference in the turn angle.
    • turnTo

      public void turnTo(RSObject o, int dev)
      Turns to within a few degrees of an RSObject.
      Parameters:
      o - The RSObject to turn to.
      dev - The maximum difference in the turn angle.
    • turnToTile

      @Deprecated public void turnToTile(RSTile tile)
      Deprecated.
      Turns to a specific RSTile.
      Parameters:
      tile - Tile to turn to.
    • turnTo

      public void turnTo(RSTile tile)
      Turns to a specific RSTile.
      Parameters:
      tile - Tile to turn to.
    • turnToTile

      @Deprecated public void turnToTile(RSTile tile, int dev)
      Deprecated.
      Turns within a few degrees to a specific RSTile.
      Parameters:
      tile - Tile to turn to.
      dev - Maximum deviation from the angle to the tile.
    • turnTo

      public void turnTo(RSTile tile, int dev)
      Turns within a few degrees to a specific RSTile.
      Parameters:
      tile - Tile to turn to.
      dev - Maximum deviation from the angle to the tile.
    • setPitch

      public boolean setPitch(boolean up)
      Sets the altitude to max or minimum.
      Parameters:
      up - True to go up. False to go down.
      Returns:
      true if the altitude was changed.
    • setRotationMethod

      public void setRotationMethod(Camera.ROTATION_METHOD rotationMethod)
    • setPitch

      public boolean setPitch(int percent)
      Set the camera to a certain percentage of the maximum pitch. Don't rely on the return value too much - it should return whether the camera was successfully set, but it isn't very accurate near the very extremes of the height. This also depends on the maximum camera angle in a region, as it changes depending on situation and surroundings. So in some areas, 68% might be the maximum altitude. This method will do the best it can to switch the camera altitude to what you want, but if it hits the maximum or stops moving for any reason, it will return. Mess around a little to find the altitude percentage you like. In later versions, there will be easier-to-work-with methods regarding altitude.
      Parameters:
      percent - The percentage of the maximum pitch to set the camera to.
      Returns:
      true if the camera was successfully moved; otherwise false.
    • moveRandomly

      public void moveRandomly(int timeOut)
      Moves the camera in a random direction for a given time.
      Parameters:
      timeOut - The maximum time in milliseconds to move the camera for.
    • setAngle

      public void setAngle(int degrees)
      Rotates the camera to a specific angle in the closest direction.
      Parameters:
      degrees - The angle to rotate to.
    • setCompass

      public void setCompass(char direction)
      Rotates the camera to the specified cardinal direction.
      Parameters:
      direction - The char direction to turn the map. char options are w,s,e,n and defaults to north if character is unrecognized.
    • setNorth

      public void setNorth()
      Uses the compass component to set the camera to face north.
    • getCharacterAngle

      public int getCharacterAngle(RSCharacter n)
      Returns the camera angle at which the camera would be facing a certain character.
      Parameters:
      n - the RSCharacter
      Returns:
      The angle
    • getObjectAngle

      public int getObjectAngle(RSObject o)
      Returns the camera angle at which the camera would be facing a certain object.
      Parameters:
      o - The RSObject
      Returns:
      The angle
    • getTileAngle

      public int getTileAngle(RSTile t)
      Returns the camera angle at which the camera would be facing a certain tile.
      Parameters:
      t - The target tile
      Returns:
      The angle in degrees
    • getAngleTo

      public int getAngleTo(int degrees)
      Returns the angle between the current camera angle and the given angle in degrees.
      Parameters:
      degrees - The target angle.
      Returns:
      The angle between the who angles in degrees.
    • getAngle

      public int getAngle()
      Returns the current compass orientation in degrees, with North at 0, increasing counter-clockwise to 360.
      Returns:
      The current camera angle in degrees.
    • getPitch

      public int getPitch()
      Returns the current percentage of the maximum pitch of the camera in an open area.
      Returns:
      The current camera altitude percentage.
    • getX

      public int getX()
      Returns the current x position of the camera.
      Returns:
      The x position.
    • getY

      public int getY()
      Returns the current y position of the camera.
      Returns:
      The y position.
    • getZ

      public int getZ()
      Returns the current z position of the camera.
      Returns:
      The z position.