mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-10-13 03:13:09 -04:00
Added isWithinFlatDistance Point3D method to determine if within radius
This commit is contained in:
@@ -108,6 +108,12 @@ public class Location implements Encodable, Serializable {
|
||||
return square(square(getX()-x) + square(getY()-y) + square(getZ()-z)) <= square(radius);
|
||||
}
|
||||
|
||||
public boolean isWithinFlatDistance(Point3D target, double radius){
|
||||
double xD = Math.abs(getX() - target.getX());
|
||||
double zD = Math.abs(getZ() - target.getZ());
|
||||
return xD + zD <= radius;
|
||||
}
|
||||
|
||||
public void translatePosition(double x, double y, double z) {
|
||||
setX(getX() + x);
|
||||
setY(getY() + y);
|
||||
|
||||
Reference in New Issue
Block a user