Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Getting the visible points of an object

Featured Replies

So I want to get the visible points of an object, because sometimes doing isVisible() returns false although some points of an object are visible.

I tried looking into the Model class of the api but didn't find anything useful to me.

 

EDIT:

I was guessing I could do something with getRasterizedPoints(), but the api doesn't tell what it really does :/

Edited by Vilius

get the model area of the object and check the intersection bounds with the game canvas.

					RS2Object object = ...; 
					Rectangle modelBounds = object.getModel().getArea(object.getGridX(), object.getGridX(), object.getZ()).getBounds();
					Rectangle canvasBounds = getBot().getCanvas().getBounds();
					Rectangle intersection = modelBounds.intersection(canvasBounds);
					int minimumDimension = 5;
					boolean visible = intersection.width > minimumDimension && intersection.height > minimumDimension;

Edited by Botre

You might want to look at GraphicUtilities#getSuitablePoint(MouseDestination destination). For an entity it calls GraphicUtilities#getModelMeshTriangles and checks what is within MAIN_SCREEN_CLIP, I think that's what you want.

  • Author

You might want to look at GraphicUtilities#getSuitablePoint(MouseDestination destination). For an entity it calls GraphicUtilities#getModelMeshTriangles and checks what is within MAIN_SCREEN_CLIP, I think that's what you want.

Thank you very much, exactly what I needed.

Code for those who need it:

	private boolean isPointOnScreen(Entity e) {
		if (e != null) {
			ArrayList<Polygon> poly = GraphicUtilities.getModelMeshTriangles(bot, e.getGridX(), e.getGridY(), e.getZ(),
					e.getModel());
			for (Polygon p : poly) {
				if (GraphicUtilities.MAIN_SCREEN_CLIP.contains(p.getBounds())) {
					return true;
				}
			}
		}
		return false;
	}

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.