垂直方向の動きの公式
ジャンプの公式
ジャンプ中のプレイヤーの垂直方向の速度は簡単に計算できる:
- Failed to parse (syntax error): {\displaystyle V\displaystyle _{Y,t} = \left (V_{Y,t-1} - \underset{重力}{0.08} \right ) \times \underset{抗力}{0.98}}
の場合、は0に設定される(そのtickでは高さは変化しない)。
1.9以降では、このしきい値は0.003となる。
注
- は、重要でないため値は割り当てられない。慣用的に、0tick目の速度はジャンプ前の初速に対応する。
- は、ジャンプの初速に対応する。跳躍力上昇のレベルが1上がるごとに0.1ずつ増加する。
- 1.9でmomentum thresholdが引き下げられたため、ジャンプの高さが僅かに上昇した(以前=1.249、現在=1.252)。
- 終端速度は-3.92m/t。
- ブロックに対して垂直方向に接触すると、垂直方向の移動がキャンセルされ、加速度のみが保持される。
滞空時間
- ジャンプの滞空時間とは、ジャンプから着地までのtick数のこと。
- また、繰り返しジャンプする場合のジャンプの周期にも対応する。
- この概念は、Tierと関連している。
説明 滞空時間 Flatのジャンプ 12 t 3bcのジャンプ 11 t +0.5のジャンプ 10 t +1のジャンプ 9 t 2.5bcのジャンプ 6 t 2bcのジャンプ 3 t 1.8125bcのジャンプ 2 t
ソースコード
/* Code unrelated to vertical movement is cut out */ </div> <div lang="en" dir="ltr" class="mw-content-ltr"> protected float getJumpUpwardsMotion(){ return 0.42F; } </div> <div lang="en" dir="ltr" class="mw-content-ltr"> protected void jump() { this.motionY = this.getJumpUpwardsMotion(); if (this.isPotionActive(Potion.jump)) { this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F; } this.isAirBorne = true; } </div> <div lang="en" dir="ltr" class="mw-content-ltr"> public void moveEntityWithHeading(float strafe, float forward) { ... /* also moves the player horizontally */ </div> <div lang="en" dir="ltr" class="mw-content-ltr"> this.motionY -= 0.08; this.motionY *= 0.98; } </div> <div lang="en" dir="ltr" class="mw-content-ltr"> public void onLivingUpdate() { if (this.jumpTicks > 0) --this.jumpTicks; </div> <div lang="en" dir="ltr" class="mw-content-ltr"> if (Math.abs(this.motionY) < 0.005D) this.motionY = 0.0D; </div> <div lang="en" dir="ltr" class="mw-content-ltr"> if (this.isJumping) { ... /* different if in water or lava */ </div> <div lang="en" dir="ltr" class="mw-content-ltr"> if (this.onGround && this.jumpTicks == 0) { this.jump(); this.jumpTicks = 10; //activate autojump cooldown (0.5s) } } else { this.jumpTicks = 0; //reset autojump cooldown } </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ... this.moveEntityWithHeading(this.moveStrafing, this.moveForward); }