changed rotation of orbs and discs based on their heading

This commit is contained in:
luisc committed 2026-02-23 16:15:43 -06:00
1 parent 0a85bb5a7b
commit fcbd2545cb
3 files changed
+48

No files matched your search

@@ -0,0 +1,24 @@
package noppes.npcs.util;
import net.minecraft.util.Vec3;
public class MathUtil {
public static float getYaw(Vec3 vector) {
double x = vector.xCoord;
double z = vector.zCoord;
double yawRad = Math.atan2(z, x);
return 90F - (float) Math.toDegrees(yawRad);
}
public static float getPitch(Vec3 vector) {
double x = vector.xCoord;
double y = vector.yCoord;
double z = vector.zCoord;
double horizontalMag = Math.sqrt(x * x + z * z);
double pitchRad = Math.atan2(y, horizontalMag);
return (float) -Math.toDegrees(pitchRad);
}
}