can now properly calculate angles below horizon

This commit is contained in:
Soper Aylamo 2021-06-20 03:10:51 -04:00
parent a3c7044620
commit 655b3e1850
Signed by: Soper
GPG Key ID: A27AC885ACC3BEAE

View File

@ -16,6 +16,8 @@ public class ArtyMath {
public static double calculateElevation(Vector vector){ public static double calculateElevation(Vector vector){
//TODO: Rewrite this method using math from scratch instead of another method //TODO: Rewrite this method using math from scratch instead of another method
Vector groundProjection = new Vector(vector.getX(), 0, vector.getZ()); Vector groundProjection = new Vector(vector.getX(), 0, vector.getZ());
double angle = groundProjection.angle(vector);
if(vector.getY() < 0) return -angle;
return groundProjection.angle(vector); return groundProjection.angle(vector);
} }