[Solved]Help with Vectors and Direction

Discussion in 'Plugin Development' started by Malikk, Apr 2, 2012.

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

    Malikk

    Hey everybody,

    I need a little help getting a block. Basically, I know two points and I need to find a third based on the direction and distance of the first two.

    I know blocks A and B, I need to be able to calculate C.

    They are all in a line and touching, but could be facing any direction.

    [BlockA][BlockB][BlockC]

    So, with blocks A and B as Vectors,
    Code:
    Vector v1 = block.getLocation().toVector();
    Vector v2 = arrow.getLocation().toVector();
    I can get a direction by,
    Code:
    Location forward = v1.subtract(v2);
    How can I take that direction and essentially 'add one' in whatever direction it's facing?

    Thanks in advance for any help :)

    If somebody even knows as much as how to turn that into a compass direction, that would be enough for me to figure the rest out, i think.

    figured it out. But obviously this threads not getting a lot of attention.

    To anyone else trying to figure it out, good luck

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  2. Offline

    Sir White

    One question, why are you using Vectors? Vectors are so outdated.
     
  3. what?
     
Thread Status:
Not open for further replies.

Share This Page