Skip 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 Entity camera degrees in relation to the player?

Featured Replies

Hi, I'd like to make use of the camera.movePitch(deg) and camera.moveYaw(deg) threaded functions for asynchronous camera movement.

 

I am however currently stuck with getting the correct degree value in relationship to the player, is there any built-in API way to do this or do I need to do the calculations myself using getPosition()?

 

Currently I am using this, but I'd prefer to use the above mentioned methods for stability reasons

private void rotateCamera(Position pos){
	if(!turningCam){
	    Runnable r = new Runnable() {
	    	//Position p = pos;
	        public void run() {
	        	turningCam = true;
	        	camera.getCamera().toPosition(pos);
	        	turningCam = false;
	        }
	    };
	    new Thread(r).start();
	}
}

Regards

The math isn't too bad. Try this

Position player = myPosition();
Position op = some other position;

int angle = 90 + (int) Math.toDegrees(Math.atan2(-(player.getY() - op.getY()), player.getX() - op.getX()));
int yaw = angle < 0 ? Math.abs(angle) : 360 - angle;
  • Author

FrostBug, it indeed wasn't too bad

        Position chest = getObjects().closest(dispenserID).getPosition();
        Position player = myPlayer().getPosition();
        
        double deltaX = player.getX() - chest.getX();
        double deltaY = player.getY() - chest.getY();
        double angleInDegrees = Math.atan2(deltaY, deltaX) * 180 / Math.PI;
        angleInDegrees = (angleInDegrees + 360) % 360;

Just found out that the position always seems to be offset by 90 degrees.

 

A similar solution might be worth including in the position API?

 

Regards

Edited by Abuse

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.