Solved Vector to Direction

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

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


    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


  3. Offline


  4. Offline


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


    I found this:

    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


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

Share This Page