Getting all locations between two locations

Discussion in 'Plugin Development' started by jimbo8, May 16, 2015.

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


    Hi there!

    So, I am currently developing a hidden feature for me and my girlfriend; whenever we get within 5 blocks of radius, a line of hearts are going to occur between us. Now, to do this, I need to get the locations(XYZ) within the two locations, without the location being a square, because it is supposed to be a line, not a bunch of hearts in a square.

    I have tried with vectors, though you cannot convert vectors to XYZ-coordinates, which is needed to spawn particles.

    Any ideas? Thanks!
  2. Offline


    Bukkits Vector class has methods for getting the XYZ components of the vector.
  3. Offline


    Hmmmm intresting, i am not so sure how can you predict the way you will aproach eachother to show the hears, and it all becomes hard when you are moving diagonally to X and Z axis :/

    Instead of a line of hearts, there is an easy way to display heart particles on the player entities if they are in a certain distance one to another if you are intrested :D

    Btw i find this "surprise" verry sweet :- ) if you need help leme know.
  4. Offline


    Take a #distanceSquared of the two player objects:

    1. Player you = /*...*/;
    2. Player them = /*...*/;
    3. double magnitude = /* some radius */;
    4. if (you.getLocation().distanceSquared(them.getLocation()) <= magitude) {
    5. //show hearts
    6. }
  5. Offline


    I sort of managed to do what I wanted with some help from a really nice user on another forum;


    though it is not exactly like I wanted it to be. I'll keep you guys updated. The hearts are going towards my seconds user, for info :)



    She thought it was really cute! This is how it ended:


    EDIT by Timtower: merged posts
    Last edited by a moderator: May 16, 2015
    mine-care and blablubbabc like this.
  6. Offline


  7. Offline


    @jimbo8 Can you let us know how you accomplished this?
Thread Status:
Not open for further replies.

Share This Page