gpu: limit interaction distance from camera

The bounding box limitation is not enough for preventing users from interacting with objects far away when the game window is wide.

This introduces a limit on how far away the camera can be from objects for you to be able to interact with them, remedying the issue above.
This commit is contained in:
Lotto
2018-11-17 16:15:28 +01:00
parent 2cfdde3a07
commit 5e3caf9190

View File

@@ -20,6 +20,7 @@ public abstract class ClickboxMixin implements RSClient
private static final int MAX_ENTITES_AT_MOUSE = 1000;
private static final int CLICKBOX_CLOSE = 50;
private static final int CLICKBOX_FAR = 3500;
private static final int OBJECT_INTERACTION_FAR = 35; // Max distance, in tiles, from camera
@Inject
private static final int[] rl$modelViewportXs = new int[4700];
@@ -45,6 +46,11 @@ public abstract class ClickboxMixin implements RSClient
return;
}
if (Math.sqrt(_x * _x + _z * _z) > OBJECT_INTERACTION_FAR * Perspective.LOCAL_TILE_SIZE)
{
return;
}
// only need a boundingbox check?
if (model.isClickable())
{