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
  • Try asking for help in the chatbox
  • Camera.getYaw(Entity)


    falador1
     Share

    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;
    
    }
    Edited by falador1
    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 😢

    Edited by falador1
    Link to comment
    Share on other sites

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

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • 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.