rl-api: use TileObjects' z for hulls/clickboxes/outlines

This commit is contained in:
Max Weber
2022-03-07 12:35:18 -07:00
parent 4f8991dc7e
commit 52c2061ccd
4 changed files with 24 additions and 38 deletions

View File

@@ -60,11 +60,9 @@ public interface GraphicsObject extends Renderable
int getLevel();
/**
* Gets the height of the graphic.
*
* @return the height
* Gets the z coordinate
*/
int getHeight();
int getZ();
/**
* Checks if this spotanim is done animating

View File

@@ -42,6 +42,7 @@ import net.runelite.api.geometry.SimplePolygon;
import net.runelite.api.model.Jarvis;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import org.jetbrains.annotations.ApiStatus;
/**
* A utility class containing methods to help with conversion between
@@ -677,21 +678,19 @@ public class Perspective
* @param client the game client
* @param model the model to calculate a clickbox for
* @param orientation the orientation of the model (0-2048, where 0 is north)
* @param point the coordinate of the tile
* @param x x coord in local space
* @param z y coord in local space
* @return the clickable area of the model
*/
@Nullable
public static Shape getClickbox(@Nonnull Client client, Model model, int orientation, LocalPoint point)
@ApiStatus.Internal
public static Shape getClickbox(@Nonnull Client client, Model model, int orientation, int x, int y, int z)
{
if (model == null)
{
return null;
}
int x = point.getX();
int y = point.getY();
int z = getTileHeight(client, point, client.getPlane());
SimplePolygon bounds = calculateAABB(client, model, orientation, x, y, z);
if (bounds == null)

View File

@@ -53,6 +53,11 @@ public interface TileObject
*/
int getY();
/**
* Gets the vertical coordinate of this object
*/
int getZ();
/**
* Gets the plane of the tile that the object is on.
*/