Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Camera.getYaw(Entity)


    Recommended Posts

    Hey, is it possible to have a getter function for yaw for an entity. Trying to randomize Camera.rotateto(Entity) is difficult. There might already be a function i'm not seeing?


    EDIT: Looking back I put pitch in the title when I should've put Yaw. If anyone comes across this heres the helper function


    public int getYaw(Entity ent) {
        //vector going to game object
        int[] gameVector = {ent.getX() - getLocalPlayer().getX(), ent.getY() - getLocalPlayer().getY()};
        //default 0 yaw vector <0, 1>
        int[] playerVector = {0, 1};
        //radian of angle
        double rad = Math.acos(gameVector[1]/(Math.sqrt(Math.pow(gameVector[0], 2) + Math.pow(gameVector[1], 2))));
        //convert to yaw
        int yaw = (int) (2048 -(rad * (1024/Math.PI)));
        log("Yaw is: " + yaw);
        return yaw;
    Link to comment
    Share on other sites

    I'm not sure what you're looking for, an entity's pitch and yaw? Or the pitch and yaw the game camera should be at? In either case we don't have a method like that, but you can do some simple math to write your own helper method if you really want to. 

    Link to comment
    Share on other sites

    The pitch and yaw the camera should be at. I was wanting to create a camera movement algorithm that could randomize my camera movements similar to the setMouseMovement function. There doesn't seem to be a an open source method for it, so trying to make my spaghetti code work. xD


    I could get the tile of my character compare to the entity tile and adjust camera accordingly. Just wondering if you guys already wrote that logic in rotatetoentity. Thanks for the response more coding for me 😢

    Link to comment
    Share on other sites

    • falador1 changed the title to Camera.getYaw(Entity)


    This topic is now archived and is closed to further replies.

    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.