Jumping/ja: Difference between revisions

From Minecraft Parkour Wiki
Content added Content deleted
(Created page with "__NOTOC__ ジャンプは、言わずと知れた、極めて重要な仕組みである。")
(Created page with "そのため、ダッシュジャンプは速度を高め、保持するのに非常に効率的な方法となっている。")
 
(7 intermediate revisions by the same user not shown)
Line 32: Line 32:
== 速度 ==
== 速度 ==


[[Special:MyLanguage/Sprinting|ダッシュ]]と組み合わせた場合、ジャンプすると向いている方向に0.2の加速度が得られる。
<div lang="en" dir="ltr" class="mw-content-ltr">
When combined with [[Special:MyLanguage/Sprinting|Sprinting]], jumping adds 0.2 units of acceleration towards the player's facing.
</div>


空中では、加速は遅くなるが(基本加速度の20%のみ)、より多くの速度が保持される(毎tick、地面での54.6%に対し91%)。
<div lang="en" dir="ltr" class="mw-content-ltr">
In air, the player accelerates less quickly (only 20% of the base acceleration value), but conserves more speed (91% every tick, instead of 54.6%).
</div>


そのため、ダッシュジャンプは速度を高め、保持するのに非常に効率的な方法となっている。
<div lang="en" dir="ltr" class="mw-content-ltr">
Therefore, sprint-jumping is a very efficient way to build and conserve speed.
</div>




Line 48: Line 42:
== ソースコード ==
== ソースコード ==


以下はジャンプがどのように発動しているかに関するコード。<syntaxhighlight lang="java">
<div lang="en" dir="ltr" class="mw-content-ltr">
/* EntityLivingBase.javaから、無関係なコードは削除 */
The following snippets of code deal with how jump is activated.<syntaxhighlight lang="java">
/* From EntityLivingBase.java, stripped of irrelevant code */
public void onLivingUpdate()
public void onLivingUpdate()
{
{
if (this.jumpTicks > 0)
if (this.jumpTicks > 0)
--this.jumpTicks;
--this.jumpTicks;
</div>


if (this.isJumping)
<div lang="en" dir="ltr" class="mw-content-ltr">
if (this.isJumping)
{
{
if (this.isInWater())
if (this.isInWater())
this.handleJumpWater(); //motionY += 0.04
this.handleJumpWater(); //motionY += 0.04
</div>


else if (this.isInLava())
<div lang="en" dir="ltr" class="mw-content-ltr">
else if (this.isInLava())
this.handleJumpLava(); //motionY += 0.04
this.handleJumpLava(); //motionY += 0.04
</div>


else if (this.onGround && this.jumpTicks == 0)
else if (this.onGround && this.jumpTicks == 0)
Line 76: Line 64:
}
}


//ジャンプキーを離すと10tickのクールダウンがリセットされる
<div lang="en" dir="ltr" class="mw-content-ltr">
//releasing the jump key resets the 10 tick cooldown.
else
else
this.jumpTicks = 0;
this.jumpTicks = 0;
}
}
</div>




/* EntityLivingBase.javaから */
<div lang="en" dir="ltr" class="mw-content-ltr">
/* From EntityLivingBase.java */
protected void jump()
protected void jump()
{
{
this.motionY = 0.42; //Initial speed
this.motionY = 0.42; //初速
</div>


//跳躍力上昇の適用
<div lang="en" dir="ltr" class="mw-content-ltr">
//apply jump boost
if (this.isPotionActive(Potion.jump))
if (this.isPotionActive(Potion.jump))
this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F;
this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F;
</div>


//ダッシュジャンプのブーストの適用
<div lang="en" dir="ltr" class="mw-content-ltr">
//apply sprintjump boost
if (this.isSprinting())
if (this.isSprinting())
{
{
float f = this.rotationYaw * 0.017453292F; //multiply by pi/180 to convert to radians
float f = this.rotationYaw * 0.017453292F; //pi/180をかけてラジアンに変換
this.motionX -= MathHelper.sin(f) * 0.2F;
this.motionX -= MathHelper.sin(f) * 0.2F;
this.motionZ += MathHelper.cos(f) * 0.2F;
this.motionZ += MathHelper.cos(f) * 0.2F;
Line 107: Line 88:
}
}
</syntaxhighlight>
</syntaxhighlight>
</div>

Latest revision as of 12:33, 8 June 2022

Other languages:

ジャンプは、言わずと知れた、極めて重要な仕組みである。


発動

ジャンプするには、その前のtickで地面に立っている必要がある。ブロック縁からでも1tick走って(例:ずらし)ジャンプできるのはこのためである。

ジャンプキーを押し続けていると、10tick(0.5秒)ごとに1回ジャンプできる。

  • 各ジャンプの高さが0.75b以上の場合、ジャンプキーを押し続けるのは最適ではない(結果: ブロックを積み上げる時は押し直しの方が速い)。
  • ジャンプキーを離すとクールダウンがリセットされるため、その次tickで再度ジャンプできる。

ジャンプすると、垂直方向の速度が0.42に設定される。その後毎tick、速度は0.08減少(重力)の後、0.98倍(空気抵抗)される。

  • 天井にぶつかると、垂直方向の速度が0に設定され、すぐに落下し始める。
  • 地面にぶつかると、垂直方向の速度が0に設定され、onGroundフラグがtrueになる。

水/溶岩の中でジャンプすると、上方向に移動する。


ジャンプの高さ

1.8以前はジャンプの最高点は1.249b。1.9で約0.003b上昇し、1.252bの高さまでジャンプできるようになった。

平らな地面では、1ジャンプの滞空時間は12tick(0.6秒)。


速度

ダッシュと組み合わせた場合、ジャンプすると向いている方向に0.2の加速度が得られる。

空中では、加速は遅くなるが(基本加速度の20%のみ)、より多くの速度が保持される(毎tick、地面での54.6%に対し91%)。

そのため、ダッシュジャンプは速度を高め、保持するのに非常に効率的な方法となっている。


ソースコード

以下はジャンプがどのように発動しているかに関するコード。

/* EntityLivingBase.javaから、無関係なコードは削除 */
public void onLivingUpdate()
{
    if (this.jumpTicks > 0)
        --this.jumpTicks;

    if (this.isJumping)
    {
        if (this.isInWater())
            this.handleJumpWater(); //motionY += 0.04

        else if (this.isInLava())
            this.handleJumpLava();  //motionY += 0.04

        else if (this.onGround && this.jumpTicks == 0)
        {
                this.jump();
                this.jumpTicks = 10;
        }
    }

    //ジャンプキーを離すと10tickのクールダウンがリセットされる
    else
        this.jumpTicks = 0;
}


/* EntityLivingBase.javaから */
protected void jump()
{
    this.motionY = 0.42; //初速

    //跳躍力上昇の適用
    if (this.isPotionActive(Potion.jump))
        this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F;

    //ダッシュジャンプのブーストの適用
    if (this.isSprinting())
    {
        float f = this.rotationYaw * 0.017453292F; //pi/180をかけてラジアンに変換
        this.motionX -= MathHelper.sin(f) * 0.2F;
        this.motionZ += MathHelper.cos(f) * 0.2F;
    }
}