Vertical Movement Formulas/ja: Difference between revisions
Content added Content deleted
(Created page with ":{| class="wikitable" !説明 !滞空時間 |- |Flatのジャンプ |12 t |- |3bcのジャンプ |11 t |- |<nowiki>+0.5 Jump</nowiki> |10 t |- | +1のジャンプ |9 t |- |2.5bcのジャンプ |6 t |- |2bcのジャンプ |3 t |- |1.8125bcのジャンプ |2 t |}") |
No edit summary |
||
(10 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
*<math>V\displaystyle _{Y,1} = 0.42</math> |
*<math>V\displaystyle _{Y,1} = 0.42</math> |
||
*<math>V\displaystyle _{Y,t} = \left (V_{Y,t-1} - \underset{重力}{0.08} \right ) \times \underset{抗力}{0.98}</math> |
*<math>V\displaystyle _{Y,t} = \left (V_{Y,t-1} - \underset{重 力}{0.08} \right ) \times \underset{抗 力}{0.98}</math> |
||
Line 45: | Line 45: | ||
|11 t |
|11 t |
||
|- |
|- |
||
|<nowiki>+0.5 |
|<nowiki>+0.5のジャンプ</nowiki> |
||
|10 t |
|10 t |
||
|- |
|- |
||
Line 65: | Line 65: | ||
==ソースコード== |
==ソースコード== |
||
⚫ | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
⚫ | |||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
:<syntaxhighlight lang="java"> |
:<syntaxhighlight lang="java"> |
||
/* 垂直方向の動きに無関係なコードは削除済み */ |
|||
/* Code unrelated to vertical movement is cut out */ |
|||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
protected float getJumpUpwardsMotion(){ |
protected float getJumpUpwardsMotion(){ |
||
return 0.42F; |
return 0.42F; |
||
} |
} |
||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
protected void jump() |
protected void jump() |
||
{ |
{ |
||
Line 91: | Line 84: | ||
this.isAirBorne = true; |
this.isAirBorne = true; |
||
} |
} |
||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
public void moveEntityWithHeading(float strafe, float forward) |
public void moveEntityWithHeading(float strafe, float forward) |
||
{ |
{ |
||
... /* |
... /* プレイヤーの水平方向の移動も行われる */ |
||
</div> |
|||
⚫ | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
⚫ | |||
this.motionY *= 0.98; |
this.motionY *= 0.98; |
||
} |
} |
||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
public void onLivingUpdate() |
public void onLivingUpdate() |
||
{ |
{ |
||
if (this.jumpTicks > 0) |
if (this.jumpTicks > 0) |
||
--this.jumpTicks; |
--this.jumpTicks; |
||
</div> |
|||
⚫ | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
⚫ | |||
this.motionY = 0.0D; |
this.motionY = 0.0D; |
||
</div> |
|||
⚫ | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
⚫ | |||
{ |
{ |
||
... /* |
... /* 水や溶岩内では異なる */ |
||
</div> |
|||
⚫ | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
⚫ | |||
{ |
{ |
||
this.jump(); |
this.jump(); |
||
this.jumpTicks = 10; // |
this.jumpTicks = 10; //自動ジャンプクールダウンの発動(0.5秒) |
||
} |
} |
||
} |
} |
||
Line 136: | Line 117: | ||
else |
else |
||
{ |
{ |
||
this.jumpTicks = 0; // |
this.jumpTicks = 0; //自動ジャンプクールダウンのリセット |
||
} |
} |
||
</div> |
|||
⚫ | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
⚫ | |||
this.moveEntityWithHeading(this.moveStrafing, this.moveForward); |
this.moveEntityWithHeading(this.moveStrafing, this.moveForward); |
||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
</div> |
Latest revision as of 11:12, 22 June 2022
ジャンプの公式
ジャンプ中のプレイヤーの垂直方向の速度は簡単に計算できる:
- 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
ソースコード
/* 垂直方向の動きに無関係なコードは削除済み */ protected float getJumpUpwardsMotion(){ return 0.42F; } 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; } public void moveEntityWithHeading(float strafe, float forward) { ... /* プレイヤーの水平方向の移動も行われる */ this.motionY -= 0.08; this.motionY *= 0.98; } public void onLivingUpdate() { if (this.jumpTicks > 0) --this.jumpTicks; if (Math.abs(this.motionY) < 0.005D) this.motionY = 0.0D; if (this.isJumping) { ... /* 水や溶岩内では異なる */ if (this.onGround && this.jumpTicks == 0) { this.jump(); this.jumpTicks = 10; //自動ジャンプクールダウンの発動(0.5秒) } } else { this.jumpTicks = 0; //自動ジャンプクールダウンのリセット } ... this.moveEntityWithHeading(this.moveStrafing, this.moveForward); }