Vertical Movement Formulas/zh: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
如果<math display="inline"> \left | V\displaystyle _{Y,t} \right | < 0.005 </math>,则<math display="inline">V\displaystyle _{Y,t}</math>会被设为 0(该 |
如果<math display="inline"> \left | V\displaystyle _{Y,t} \right | < 0.005 </math>,则<math display="inline">V\displaystyle _{Y,t}</math>会被设为 0(该刻玩家的高度不会改变)。 |
||
在 1.9+,这个阈值变为 0.003。 |
在 1.9+,这个阈值变为 0.003。 |
||
Line 19: | Line 19: | ||
'''注意''' |
'''注意''' |
||
*<math display="inline"> V\displaystyle _{Y,0}</math> 并没有被赋值,因为这无关紧要。按照惯例,第 0 |
*<math display="inline"> V\displaystyle _{Y,0}</math> 并没有被赋值,因为这无关紧要。按照惯例,第 0 刻对应玩家跳跃前的初始速度。 |
||
*<math display="inline"> V\displaystyle _{Y,1}</math> 对应初始跳跃速度。每拥有一级[[Special:MyLanguage/Status Effects|跳跃提升]]这个值就增加 0.1。 |
*<math display="inline"> V\displaystyle _{Y,1}</math> 对应初始跳跃速度。每拥有一级[[Special:MyLanguage/Status Effects|跳跃提升]]这个值就增加 0.1。 |
||
*在 1.9 中跳跃高度略有提高,因为动量阈值被降低了(原来=1.249,现在=1.252)。 |
*在 1.9 中跳跃高度略有提高,因为动量阈值被降低了(原来=1.249,现在=1.252)。 |
||
Line 29: | Line 29: | ||
==跳跃持续时间== |
==跳跃持续时间== |
||
:跳跃的'''持续时间'''是起跳与落地之间 |
:跳跃的'''持续时间'''是起跳与落地之间刻的数量。 |
||
:重复跳跃时,这也代表此类跳跃的循环周期。 |
:重复跳跃时,这也代表此类跳跃的循环周期。 |
Revision as of 13:55, 11 June 2022
跳躍公式
可以簡單地計算出玩家在一次跳躍過程中的垂直速度:
- Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle V\displaystyle _{Y,t} = \left (V_{Y,t-1} - \underset{\textrm{重 力}}{0.08} \right ) \times \underset{\textrm{阻 力}}{0.98}}
如果,則會被設為 0(該刻玩家的高度不會改變)。
在 1.9+,這個閾值變為 0.003。
注意
- 並沒有被賦值,因為這無關緊要。按照慣例,第 0 刻對應玩家跳躍前的初始速度。
- 對應初始跳躍速度。每擁有一級跳躍提升這個值就增加 0.1。
- 在 1.9 中跳躍高度略有提高,因為動量閾值被降低了(原來=1.249,現在=1.252)。
- 終端速度為 -3.92 m/t。
- 當玩家與方塊垂直碰撞時,垂直動量被取消,僅保留加速度。
跳躍持續時間
- 跳躍的持續時間是起跳與落地之間刻的數量。
- 重複跳躍時,這也代表此類跳躍的循環周期。
- 這個概念與 Tiers(階)的概念有關。
介紹 持續時間 平地跳躍 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); }