Skip to content

Commit

Permalink
calculate height based on camera y - foot y instead of relying on min…
Browse files Browse the repository at this point in the history
…ecraft being correct
  • Loading branch information
der-fruhling committed Aug 8, 2024
1 parent ae32868 commit 651ef45
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static float getExtraYRot(Perspective persp, float xRot, float yRot, floa
public static Vector3d applyStandingCameraTranslation(Player player, double x, double y, double z, Perspective persp, float f) {
var lean = persp.getLean(f) * Mth.DEG_TO_RAD;
var yaw = persp.getYaw(f) * Mth.DEG_TO_RAD;
var height = player.getEyeHeight();
var height = y - player.getY();
var newY = y + ((height * Mth.cos(lean)) - height);
var leanSin = Mth.sin(lean);
var newZ = z - (height * Mth.sin(yaw) * leanSin);
Expand Down

0 comments on commit 651ef45

Please sign in to comment.