Solved Get the direction the player needs to walk to get to other location

Discussion in 'Spigot Plugin Development' started by David_Mayr, Mar 7, 2020.

  1. How can i get the direction the player needs to walk to get to other location? I want to display arrows in the actionbar the show the player in witch direction they need to walk
     
  2. SteelPhoenix

    Moderator

    Code (Java):
    Location l1 = ...;
    Location l2 = ...;
    Vector dir = l2.clone().subtract(l1).toVector();
     
  3. Okay thanks. Whats the best way now to display a arrow unicode to show it to the player? I know how do send an actionbar but how should i convert the direction to the unicodes? if else or switch should be logical but how do i know the values?
     
  4. Closest thing would be to create a compass like text,wich changes based on direction
     
  5. Yes but how can i do this?
     
  6. Just... like get the Unicode character and display it at a certain update rate?
     
  7. I know but how can i check the direction? Thanks to @SteelPhoenix i know how to get the direction but i still dont know what return values are what. i know nothing about the vectors in spigot
     
  8. use the compass it has methods to set where it points
     
  9. How should i get the compass in the actionbar? xD but thanks to the thread that @Schottky posted i got it now