Package rsb.methods
Class Camera
java.lang.Object
rsb.methods.MethodProvider
rsb.methods.Camera
Camera related operations.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class rsb.methods.MethodProvider
methods
-
Method Summary
Modifier and TypeMethodDescriptionint
getAngle()
Returns the current compass orientation in degrees, with North at 0, increasing counter-clockwise to 360.int
getAngleTo
(int degrees) Returns the angle between the current camera angle and the given angle in degrees.int
Returns the camera angle at which the camera would be facing a certain character.int
Returns the camera angle at which the camera would be facing a certain object.int
getPitch()
Returns the current percentage of the maximum pitch of the camera in an open area.int
Returns the camera angle at which the camera would be facing a certain tile.int
getX()
Returns the current x position of the camera.int
getY()
Returns the current y position of the camera.int
getZ()
Returns the current z position of the camera.void
moveRandomly
(int timeOut) Moves the camera in a random direction for a given time.void
setAngle
(int degrees) Rotates the camera to a specific angle in the closest direction.void
setCompass
(char direction) Rotates the camera to the specified cardinal direction.void
setNorth()
Uses the compass component to set the camera to face north.boolean
setPitch
(boolean up) Sets the altitude to max or minimum.boolean
setPitch
(int percent) Set the camera to a certain percentage of the maximum pitch.void
setRotationMethod
(Camera.ROTATION_METHOD rotationMethod) void
Turns to a RSCharacter (RSNPC or RSPlayer).void
turnTo
(RSCharacter c, int dev) Turns to within a few degrees of an RSCharacter (RSNPC or RSPlayer).void
Turns to an RSObject.void
Turns to within a few degrees of an RSObject.void
Turns to a specific RSTile.void
Turns within a few degrees to a specific RSTile.void
Deprecated.void
turnToCharacter
(RSCharacter c, int dev) Deprecated.void
Deprecated.void
turnToObject
(RSObject o, int dev) Deprecated.void
turnToTile
(RSTile tile) Deprecated.void
turnToTile
(RSTile tile, int dev) Deprecated.
-
Method Details
-
turnToCharacter
Deprecated.Turns to an RSCharacter (RSNPC or RSPlayer).- Parameters:
c
- The RSCharacter to turn to.
-
turnTo
Turns to a RSCharacter (RSNPC or RSPlayer).- Parameters:
c
- The RSCharacter to turn to.
-
turnToCharacter
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
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.Turns to an RSObject- Parameters:
o
- The RSObject to turn to.
-
turnTo
Turns to an RSObject.- Parameters:
o
- The RSObject to turn to.
-
turnToObject
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
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.Turns to a specific RSTile.- Parameters:
tile
- Tile to turn to.
-
turnTo
Turns to a specific RSTile.- Parameters:
tile
- Tile to turn to.
-
turnToTile
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
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
-
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
Returns the camera angle at which the camera would be facing a certain character.- Parameters:
n
- the RSCharacter- Returns:
- The angle
-
getObjectAngle
Returns the camera angle at which the camera would be facing a certain object.- Parameters:
o
- The RSObject- Returns:
- The angle
-
getTileAngle
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.
-