Interface Locatable
- All Known Subinterfaces:
IActor,IDecorativeObject,IGameObject,IGroundObject,INPC,IPlayer,ITile,ITileItem,ITileObject,IWallObject,SceneEntity,TileEntity
Locatable entities have both world coordinates (global position across the entire game map) and local coordinates (position within the currently loaded scene).
The game world uses a coordinate system where:
- X increases going east
- Y increases going north
- Plane (Z) indicates the floor level (0 = ground, 1 = first floor, etc.)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault intdistanceTo(net.runelite.api.coords.WorldPoint other) Calculates the Chebyshev distance (max of dx, dy) to a world point.default intdistanceTo(Locatable other) Calculates the Chebyshev distance (max of dx, dy) to another locatable entity.default floatdistanceTo2DHypotenuse(net.runelite.api.coords.WorldPoint target) Find the straight-line distance from this point to another point.default floatdistanceToHypotenuse(net.runelite.api.coords.WorldPoint target) Gets the straight-line distance between the origin point and the target point.net.runelite.api.coords.LocalPointGets the local location of this entity within the loaded scene.intgetPlane()Gets the plane (floor level) of this entity.net.runelite.api.coords.WorldPointGets the world location of this entity.default intGets the world X coordinate of this entity.default intGets the world Y coordinate of this entity.
-
Method Details
-
getWorldLocation
net.runelite.api.coords.WorldPoint getWorldLocation()Gets the world location of this entity.World coordinates are absolute positions on the game map. They persist regardless of where the player's camera or loaded scene is.
- Returns:
- the world location
-
getLocalLocation
net.runelite.api.coords.LocalPoint getLocalLocation()Gets the local location of this entity within the loaded scene.Local coordinates are relative to the currently loaded 104x104 tile scene. They are used for rendering and collision calculations.
- Returns:
- the local location, or null if the entity is not in the loaded scene
-
distanceTo
Calculates the Chebyshev distance (max of dx, dy) to another locatable entity.This is the standard "tile distance" used in RuneScape for most calculations.
- Parameters:
other- the target entity- Returns:
- the tile distance
-
distanceTo
default int distanceTo(net.runelite.api.coords.WorldPoint other) Calculates the Chebyshev distance (max of dx, dy) to a world point.- Parameters:
other- the target location- Returns:
- the tile distance
-
distanceToHypotenuse
default float distanceToHypotenuse(net.runelite.api.coords.WorldPoint target) Gets the straight-line distance between the origin point and the target point.If the target is not on the same plane, this method will return
Float.MAX_VALUE. If ignoring the plane is wanted, use thedistanceTo2DHypotenuse(WorldPoint)method.- Parameters:
target- worldpoint- Returns:
- the straight-line distance
-
distanceTo2DHypotenuse
default float distanceTo2DHypotenuse(net.runelite.api.coords.WorldPoint target) Find the straight-line distance from this point to another point.This method disregards the plane value of the two tiles and returns the simple distance between the X-Y coordinate pairs.
- Parameters:
target- worldpoint- Returns:
- the straight-line distance
-
getWorldX
default int getWorldX()Gets the world X coordinate of this entity.- Returns:
- the X coordinate
-
getWorldY
default int getWorldY()Gets the world Y coordinate of this entity.- Returns:
- the Y coordinate
-
getPlane
int getPlane()Gets the plane (floor level) of this entity.Plane 0 is ground level, 1 is the first floor above ground, etc.
- Returns:
- the plane (0-3)
-