mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 10:19:08 +00:00
changed rotation of orbs and discs based on their heading
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user