implement character limb swing animation

(cherry picked from commit 19c59e38feff562ccbaade8e38fdd303bba784a5)
This commit is contained in:
LabyStudio
2022-04-14 00:45:23 +02:00
parent 7df2806456
commit 62d7ba24b9
9 changed files with 211 additions and 70 deletions
@@ -104,8 +104,8 @@ window.WorldRenderer = class {
orientCamera(partialTicks) {
let player = this.minecraft.player;
let rotationY = -MathHelper.toRadians(player.yaw + 180);
let rotationX = -MathHelper.toRadians(player.pitch);
let rotationY = -MathHelper.toRadians(player.rotationYaw + 180);
let rotationX = -MathHelper.toRadians(player.rotationPitch);
// Position
let x = player.prevX + (player.x - player.prevX) * partialTicks;
@@ -116,8 +116,10 @@ window.WorldRenderer = class {
let mode = this.minecraft.settings.thirdPersonView;
if (mode !== 0) {
// Flip for front view
if (mode === 2) {
let frontView = mode === 2;
if (frontView) {
rotationY += Math.PI;
rotationX *= -1;
}
// Shift camera