Solved Vector to Direction

Discussion in 'Plugin Development' started by xGamingDudex, Nov 1, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    xGamingDudex

    Hi, does any one know how to convert vector into a direction (Yaw & Pitch)?

    If you have a location you can do location.getDirection(); which returns a vector. But I need the direction (Yaw & Pitch) of a vector?

    Does any one know how to do this, by any means?
     
  2. Offline

    Luloak2

  3. Offline

    ferrybig

  4. Offline

    Luloak2

    Please mark this thread as "SOLVED", so everyone can see that it' s done ;)
     
  5. Offline

    adam753

    I found this:
    https://forums.bukkit.org/threads/how-do-i-get-yaw-and-pitch-from-a-vector.50317/

    Apparently, the Y value of the vector is the pitch. The yaw looks harder to get, but I can think of a quick way to find it- set the direction vector's Y to 0, and then find the angle (Vector.angle()) between that and (0, 0, 0).

    Edit: Or you can do Location's getPitch() and getYaw(), didn't think of that.
     
  6. Offline

    xGamingDudex

    Thanks guys ;)
     
Thread Status:
Not open for further replies.

Share This Page