This commit is contained in:
Leijurv 2018-08-05 20:08:41 -04:00
parent 6dddb2e895
commit 2edc7327ab
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -27,7 +27,7 @@ public final class Utils {
*/
public static Tuple<Float, Float> calcRotationFromVec3d(Vec3d orig, Vec3d dest) {
double yaw = Math.atan2(orig.x - dest.x, -orig.z + dest.z);
double dist = Math.sqrt((orig.x - dest.x) * (orig.x - dest.x) + (-orig.x + dest.x) * (-orig.z + dest.z));
double dist = Math.sqrt((orig.x - dest.x) * (orig.x - dest.x) + (-orig.z + dest.z) * (-orig.z + dest.z));
double pitch = Math.atan2(orig.y - dest.y, dist);
return new Tuple<>((float) (yaw * 180 / Math.PI),
(float) (pitch * 180 / Math.PI));