Distance between two players

Discussion in 'Plugin Development' started by 0verFull, Aug 1, 2015.

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

    0verFull

    Hi guys and girls,

    I just know how to calcul the distance between two players ?

    Thanks
     
  2. location.distance(otherLocation)
     
  3. Offline

    Chiller

    @0verFull And if you want to know how that actually works behind the scenes:
    Just some simple geometry!

    [​IMG]
     
    PDKnight and ItsMattHogan like this.
  4. Offline

    Gater12

    @0verFull
    distanceSquared if using it a lot. (With of course squaring your seeked distance too)

    Basically doesn't use expensive Math.sqrt method.
     
  5. Offline

    mythbusterma

    @Gater12

    Math.sqrt isn't expensive. The difference between the distance() and distanceSquared() is a fraction of the time it takes to call the method.
     
Thread Status:
Not open for further replies.

Share This Page