Sneaking/ja: Difference between revisions
Content added Content deleted
(Created page with "地面にいる間は、スニークしていると1マス以上の段差からは落下しなくなる。") |
No edit summary |
||
(19 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
<span id="Activation"></span> |
|||
== 発動 == |
== 発動 == |
||
Line 13: | Line 14: | ||
<span id="Effects"></span> |
|||
== 効果 == |
== 効果 == |
||
地面にいる間は、スニークしていると1マス以上の段差からは落下しなくなる。 |
地面にいる間は、スニークしていると1マス以上の段差からは落下しなくなる。 |
||
* ブロック縁に対してスニークしている間は速度が保持されるため、[https://youtu.be/y1lWdS_aZM0 助走なし3+1]などのジャンプに有用。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
* 1.11で、高さの下限値が0.6bに変更された。 |
|||
* Speed is conserved when sneaking against the edge of a block, which is useful for specific jumps such as [https://youtu.be/y1lWdS_aZM0 no-mm 3+1]. |
|||
* スニーク中にブロック縁に着地すると、「shift glitch」が発生し、落下する場合がある(1.16.2で修正)。 |
|||
* In 1.11+, the lower limit is changed to 0.6b |
|||
* 地面でのスニーク中に、予期せず落下する場合がある([https://youtu.be/EqWbKIrS-FY 例])。 - 1.16.2で一部修正。 |
|||
* A "shift glitch" happens when the player lands on the edge of a block while sneaking, in which case they may fall off (fixed in 1.16.2). |
|||
* In some cases, the player may fall off unexpectedly while sneaking on ground ([https://youtu.be/EqWbKIrS-FY examples]) - partly fixed in 1.16.2. |
|||
</div> |
|||
スニーク中は、[[Special:MyLanguage/Ladders and Vines|はしごとツタ]]に掴まることができる。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
When sneaking, the player can hang on the side of [[Special:MyLanguage/Ladders and Vines|ladders and vines]]. |
|||
</div> |
|||
* 登ることは通常通りできるが、ブロック範囲内にいる限り落下しなくなる。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
* 一般に、はしご系のジャンプはスニークすることで簡単になる。 |
|||
* They can still climb up as usual, but they can't fall down as long they stay within the block. |
|||
* In general, sneaking makes ladder jumps much easier. |
|||
</div> |
|||
1.9以降は、スニークするとプレイヤーの身長が1.65mに低下する。1.14以降は更に低くなり、1.5mになる。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
In 1.9+, sneaking lower the player's height down to 1.65m. In 1.14+, sneaking lowers it even more, down to 1.5m. |
|||
</div> |
|||
<span id="Speed"></span> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
== |
== 速度 == |
||
</div> |
|||
ダッシュは歩きより70%遅く、基本加速度は'''0.03'''である。ただし、適用方法は歩きやダッシュとは異なる: |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
Sneaking is 70% slower than walking, granting a base acceleration of '''0.03''', but it doesn't get applied the same way as walking and sprinting: |
|||
</div> |
|||
* 前方にスニークしている場合、地面での加速度は0.03×0.98 = 0.0294となり、予期される通り。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
* [[Special:MyLanguage/45 Strafe|斜めに]]スニークしている場合、地面での加速度は0.0294×'''√'''2 ≒ 0.0416となる。 |
|||
* When sneaking forward, the ground acceleration is 0.03×0.98 = 0.0294, as expected. |
|||
* When sneaking [[Special:MyLanguage/45 Strafe|diagonally]], the ground acceleration is 0.0294×'''√'''2 ≈ 0.0416 |
|||
</div> |
|||
<span id="Code"></span> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
== |
== ソースコード == |
||
</div> |
|||
スニークの実装方法となぜ欠陥があるのかを示す。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
<syntaxhighlight lang="java"> |
|||
/* |
/* Entity.java内、無関係なコードは削除済 */ |
||
public void moveEntity(double dX, double dY, double dZ) |
public void moveEntity(double dX, double dY, double dZ) |
||
{ |
{ |
||
Line 71: | Line 59: | ||
{ |
{ |
||
double increment = 0.05; |
double increment = 0.05; |
||
</div> |
|||
//プレイヤーより下の地面で、X軸方向に最も遠いものを確認する(初期位置から) |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
//check for furthest ground under player in the X axis (from initial position) |
|||
while(dX != 0.0D && getCollidingBoundingBoxes(this.boundingBox.offset(dX,-1,0)).isEmpty()) |
while(dX != 0.0D && getCollidingBoundingBoxes(this.boundingBox.offset(dX,-1,0)).isEmpty()) |
||
{ |
{ |
||
Line 83: | Line 69: | ||
else |
else |
||
dX += increment; |
dX += increment; |
||
</div> |
|||
dX_intended = dX; |
|||
dX_intended = dX; |
|||
} |
} |
||
//プレイヤーより下の地面で、Z軸方向に最も遠いものを確認する(初期位置から) |
|||
//check for furthest ground under player in the Z axis (from initial position) |
|||
while(dZ != 0.0D && getCollidingBoundingBoxes(this.boundingBox.offset(0,-1,dZ)).isEmpty()) |
while(dZ != 0.0D && getCollidingBoundingBoxes(this.boundingBox.offset(0,-1,dZ)).isEmpty()) |
||
{ |
{ |
||
Line 98: | Line 82: | ||
else |
else |
||
dZ += increment; |
dZ += increment; |
||
</div> |
|||
dZ_intended = dZ; |
|||
dZ_intended = dZ; |
|||
} |
} |
||
//先の上限値をもとに最終的なdXとdZを計算する |
|||
//calculate definitive dX and dZ based on the previous limits. |
|||
while(dX != 0.0D && dZ != 0.0D && getCollidingBoundingBoxes(this.boundingBox.offset(dX,-1,dZ)).isEmpty()) |
while(dX != 0.0D && dZ != 0.0D && getCollidingBoundingBoxes(this.boundingBox.offset(dX,-1,dZ)).isEmpty()) |
||
{ |
{ |
||
Line 115: | Line 97: | ||
dX += increment; |
dX += increment; |
||
dX_intended = dX; |
dX_intended = dX; |
||
</div> |
|||
< |
if (dZ < increment && dZ >= -increment) |
||
if (dZ < increment && dZ >= -increment) |
|||
dZ = 0.0D; |
dZ = 0.0D; |
||
else if (dZ > 0.0D) |
else if (dZ > 0.0D) |
||
Line 128: | Line 108: | ||
} |
} |
||
} |
} |
||
</div> |
|||
... //新しいdXとdZを用いてプレイヤーを移動させる(衝突判定順: Y-X-Z) |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
... //move the player with the new values of dX and dZ (order of collisions: Y-X-Z) |
|||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
[[File:Sneak illustrated.png|none|thumb|600x600px| |
[[File:Sneak illustrated ja.png|none|thumb|600x600px|上記のコードの図解。赤いブロックはプレイヤーが緑のブロックの上でスニークするのに必要。]] |
||
</div> |
Latest revision as of 13:55, 16 November 2023
スニークは、移動速度が減少し、ブロックの縁から落ちなくなる仕組みである。
発動
スニークはスニークキーを押すと即座に発動し、押している間は発動したままになる。
スニーク中はダッシュできない(1.14以降を除く)。
効果
地面にいる間は、スニークしていると1マス以上の段差からは落下しなくなる。
- ブロック縁に対してスニークしている間は速度が保持されるため、助走なし3+1などのジャンプに有用。
- 1.11で、高さの下限値が0.6bに変更された。
- スニーク中にブロック縁に着地すると、「shift glitch」が発生し、落下する場合がある(1.16.2で修正)。
- 地面でのスニーク中に、予期せず落下する場合がある(例)。 - 1.16.2で一部修正。
スニーク中は、はしごとツタに掴まることができる。
- 登ることは通常通りできるが、ブロック範囲内にいる限り落下しなくなる。
- 一般に、はしご系のジャンプはスニークすることで簡単になる。
1.9以降は、スニークするとプレイヤーの身長が1.65mに低下する。1.14以降は更に低くなり、1.5mになる。
速度
ダッシュは歩きより70%遅く、基本加速度は0.03である。ただし、適用方法は歩きやダッシュとは異なる:
- 前方にスニークしている場合、地面での加速度は0.03×0.98 = 0.0294となり、予期される通り。
- 斜めにスニークしている場合、地面での加速度は0.0294×√2 ≒ 0.0416となる。
ソースコード
スニークの実装方法となぜ欠陥があるのかを示す。
/* Entity.java内、無関係なコードは削除済 */
public void moveEntity(double dX, double dY, double dZ)
{
double dX_intended = dX;
double dY_intended = dY;
double dZ_intended = dZ;
boolean sneakingOnGround = this.onGround && this.isSneaking();
if (sneakingOnGround)
{
double increment = 0.05;
//プレイヤーより下の地面で、X軸方向に最も遠いものを確認する(初期位置から)
while(dX != 0.0D && getCollidingBoundingBoxes(this.boundingBox.offset(dX,-1,0)).isEmpty())
{
if (dX < increment && dX >= -increment)
dX = 0.0D;
else if (dX > 0.0D)
dX -= increment;
else
dX += increment;
dX_intended = dX;
}
//プレイヤーより下の地面で、Z軸方向に最も遠いものを確認する(初期位置から)
while(dZ != 0.0D && getCollidingBoundingBoxes(this.boundingBox.offset(0,-1,dZ)).isEmpty())
{
if (dZ < increment && dZ >= -increment)
dZ = 0.0D;
else if (dZ > 0.0D)
dZ -= increment;
else
dZ += increment;
dZ_intended = dZ;
}
//先の上限値をもとに最終的なdXとdZを計算する
while(dX != 0.0D && dZ != 0.0D && getCollidingBoundingBoxes(this.boundingBox.offset(dX,-1,dZ)).isEmpty())
{
if (dX < increment && dX >= -increment)
dX = 0.0D;
else if (dX > 0.0D)
dX -= increment;
else
dX += increment;
dX_intended = dX;
if (dZ < increment && dZ >= -increment)
dZ = 0.0D;
else if (dZ > 0.0D)
dZ -= increment;
else
dZ += increment;
dZ_intended = dZ;
}
}
... //新しいdXとdZを用いてプレイヤーを移動させる(衝突判定順: Y-X-Z)
}