I am working on my crosshair. Therefore I need to get the radius of it in dependency of the distance to the player.
But it's value is always to high.
The distance values are right. It has to be something with the last line, but I don't know what it is.
public int getRadius() { double dx = getX()-playerX; double dy = getY()-playerY; if(dx<0)dx=-dx; if(dy<0)dy=-dy; double distance = Math.sqrt((dx*dx)+(dy*dy)); return (int)(Math.tan((double)Superclass.precision)*distance); }