Get the location behind the player depending on its direction

Discussion in 'Plugin Development' started by Altarry, Apr 3, 2015.

Thread Status:
Not open for further replies.
  1. Hello,

    Everything is said in the title, I want to get the location behind the player according to his direction, I found the results but they were bad.

    Good day.
     
  2. Code:
    double mpitch = ((pitch + 90) * Math.PI) / 180;
                double myaw = ((yaw + 90) * Math.PI) / 180;
                double mx = Math.sin(mpitch) * Math.cos(myaw);
                double my = Math.sin(mpitch) * Math.sin(myaw);
                double mz = Math.cos(mpitch);
    That's how you get the location there looking at, with a yaw and pitch. Remove that from the players location and you should be done.
     
  3. Offline

    MexMaster

    @Altarry
    What about substracting the direction (p.getLocation().getDirection())
    from the player location?
     
Thread Status:
Not open for further replies.

Share This Page