45 Strafe/ja: Difference between revisions
Content added Content deleted
(Created page with "strafeキーを入力し、45°方向に振り向くことで実行できる(名前の由来はそこから)。") |
No edit summary |
||
(32 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
45° Strafeとは、通常よりも高い速度を得られる技術である。 |
45° Strafeとは、通常よりも高い速度を得られる技術である。 |
||
strafeキーを入力し、45°方向 |
前進キーとstrafeキーを入力し、45°方向を向くことで実行できる(名前の由来はそこから)。 |
||
45° Strafeは以下のどちらでも可能: |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
45° Strafe can be performed by either: |
|||
</div> |
|||
* 左45°に振り向き、右Strafeキーを入力。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
* 右45°に振り向き、左Strafeキーを入力。 |
|||
* Turning 45° left and Strafing right. |
|||
*Turning 45° right and Strafing left. |
|||
</div> |
|||
振り向きは素早く(1tick以内)かつ正確(誤差最大±11.5°、±0°に近いほど良い)でなければならないため、安定して実行するのは難しい。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
The turning must be quick (< 1tick) and precise (at least ±11.5°, the closer to ±0° the better), so it's difficult to perform consistently. |
|||
</div> |
|||
1bm 4.375bなど、45° strafeが必須のジャンプも存在する。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
Some jumps require the use of 45° strafe, such as 1bm 4.375b. |
|||
</div> |
|||
<youtube>3cZ6xSqY0yw</youtube> |
<youtube>3cZ6xSqY0yw</youtube> |
||
Line 31: | Line 23: | ||
== 動きへの影響 == |
== 動きへの影響 == |
||
毎tick、プレイヤーはキー入力などの要素に基づいた加速度を得る。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
On every tick, the Player gains some acceleration depending on inputs and other factors. |
|||
</div> |
|||
* 正面に(strafe入力なしで)動いている場合、得られる加速度は<math>0.98</math>倍になる。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
* When moving forward (without strafing), the acceleration gained is scaled by <math>0.98</math> |
|||
</div> |
|||
* strafe入力ありの場合、加速度は<math>1.0</math>倍になる。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
* When strafing, the acceleration is scaled by <math>1.0</math> |
|||
</div> |
|||
よって、45° Strafeは通常の移動方法よりも<math>{1.0 \over 0.98}</math>倍(約2%)速い。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
Therefore, 45° Strafe is <math>{1.0 \over 0.98}</math> times faster than regular movement (about 2% faster). |
|||
</div> |
|||
特殊なケース: '''45°スニーク''' |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
Special case: '''45° Sneak''' |
|||
</div> |
|||
* 正面に(strafe入力なしで)スニークしている場合、得られる加速度は<math>0.98</math>倍になる。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
* strafe入力ありの場合、得られる加速度は<math>0.98 \sqrt{2}</math>(≒ 1.386)倍になる。 |
|||
* When sneaking forward (without strafing), the acceleration gained is scaled by <math>0.98</math> |
|||
*When strafing while sneaking, the acceleration gained is scaled by <math>0.98 \sqrt{2}</math> (≈ 1.386) |
|||
</div> |
|||
45°スニークは助走なしジャンプに使用される([https://youtu.be/XKCQiN76W3Y 例])。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
45° Sneak is used for no momentum jumps ([https://youtu.be/k1prrr7P5M4 example]). |
|||
</div> |
|||
通常のスニークよりも約41%速いため、bridgingなどアスレチック以外でも使用されている。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
Outside of parkour, it's notably used for bridging, as it's ~41% faster than regular sneaking. |
|||
</div> |
|||
Line 71: | Line 47: | ||
== 解説 == |
== 解説 == |
||
以下は水平方向の移動に関するソースコードを簡略化したもの。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
Below is a simplified version of the horizontal movement source code. |
|||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
<syntaxhighlight lang="java" line="1"> |
<syntaxhighlight lang="java" line="1"> |
||
/* |
/* |
||
* |
* EntityとEntityLivingBaseのソースコード |
||
* 不要、無関係な部分は削除済 |
|||
* Unnecessary or unrelated code is stripped out |
|||
*/ |
*/ |
||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
public void onLivingUpdate() |
public void onLivingUpdate() |
||
{ |
{ |
||
/* |
/* |
||
* moveStrafing |
* moveStrafingとmoveForwardは相対的な動きを表す。 |
||
* moveStrafing = 1.0 |
* moveStrafing = 左に動いている場合1.0、右に動いている場合-1.0、それ以外は0.0。 |
||
* moveForward = 1.0 |
* moveForward = 前に動いている場合1.0、後ろに動いている場合-1.0、それ以外は0.0。 |
||
* |
* |
||
* |
* 更に、スニークしている場合、moveStrafingとmoveForward *= 0.3。 |
||
*/ |
*/ |
||
</div> |
|||
this.moveStrafing *= 0.98F; |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
this.moveStrafing *= 0.98F; |
|||
this.moveForward *= 0.98F; |
this.moveForward *= 0.98F; |
||
this.moveEntityWithHeading(this.moveStrafing, this.moveForward); |
this.moveEntityWithHeading(this.moveStrafing, this.moveForward); |
||
} |
} |
||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
public void moveEntityWithHeading(float strafe, float forward) |
public void moveEntityWithHeading(float strafe, float forward) |
||
{ |
{ |
||
/* 次tickに保持される速度は慣性によって決定される */ |
|||
/* inertia determines how much speed is conserved onto the next tick */ |
|||
float mult = 0.91F; |
float mult = 0.91F; |
||
if (this.onGround) |
if (this.onGround) |
||
{ |
{ |
||
/* プレイヤーの1b下のブロックの滑りやすさを取得 */ |
|||
/* Get slipperiness 1 block below the player */ |
|||
mult *= getBlockSlipperinessAt(this.posX, this.getEntityBoundingBox().minY - 1, this.posZ); |
mult *= getBlockSlipperinessAt(this.posX, this.getEntityBoundingBox().minY - 1, this.posZ); |
||
} |
} |
||
</div> |
|||
/* 加速度 = (0.6*0.91)^3 / (滑りやすさ*0.91)^3) */ |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
/* acceleration = (0.6*0.91)^3 / (slipperiness*0.91)^3) */ |
|||
float acceleration = 0.16277136F / (mult * mult * mult); |
float acceleration = 0.16277136F / (mult * mult * mult); |
||
</div> |
|||
float movementFactor; |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
float movementFactor; |
|||
if (this.onGround) |
if (this.onGround) |
||
movementFactor = this.landMovementFactor * acceleration; |
movementFactor = this.landMovementFactor * acceleration; |
||
/* |
/* 基本加速度: 0.1; ダッシュしている場合x1.3で、ステータス効果の影響を受ける。 */ |
||
</div> |
|||
else |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
else |
|||
movementFactor = this.airMovementFactor; |
movementFactor = this.airMovementFactor; |
||
/* |
/* 基本加速度: 0.02; ダッシュしている場合x1.3。 */ |
||
</div> |
|||
this.updateMotionXZ(strafe, forward, movementFactor); |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
this.updateMotionXZ(strafe, forward, movementFactor); |
|||
this.moveEntity(this.motionX, this.motionY, this.motionZ); |
this.moveEntity(this.motionX, this.motionY, this.motionZ); |
||
</div> |
|||
this.motionY -= 0.08D; /* 重力 */ |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
this.motionY |
this.motionY *= 0.98D; /* 抗力 */ |
||
this.motionY *= 0.98D; /* drag */ |
|||
</div> |
|||
this.motionX *= mult; |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
this.motionX *= mult; |
|||
this.motionZ *= mult; |
this.motionZ *= mult; |
||
} |
} |
||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
public void updateMotionXZ(float strafe, float forward, float movementFactor) |
public void updateMotionXZ(float strafe, float forward, float movementFactor) |
||
{ |
{ |
||
/* |
/* |
||
* この関数が45° strafeが存在する原因。この世界では幾何学には何の意味もない……。 |
|||
* This function is responsible for the existence of 45° strafe. The geometry doesn't seem to make sense... |
|||
* |
* 注: |
||
* - |
* - ダッシュの倍率は「movementFactor」の中。 |
||
* - |
* - スニークの倍率は「strafe」と「forward」の中。 |
||
* これは、スニークがダッシュより遥か以前に実装されたためと思われる。 |
|||
* This is likely because Sneaking was implemented long before Sprinting |
|||
*/ |
*/ |
||
float distance = strafe * strafe + forward * forward; |
float distance = strafe * strafe + forward * forward; |
||
</div> |
|||
if (distance >= 1.0E-4F) |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
if (distance >= 1.0E-4F) |
|||
{ |
{ |
||
distance = MathHelper.sqrt_float(distance); |
distance = MathHelper.sqrt_float(distance); |
||
Line 172: | Line 123: | ||
if (distance < 1.0F) |
if (distance < 1.0F) |
||
distance = 1.0F; |
distance = 1.0F; |
||
</div> |
|||
distance = movementFactor / distance; |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
distance = movementFactor / distance; |
|||
strafe = strafe * distance; |
strafe = strafe * distance; |
||
forward = forward * distance; |
forward = forward * distance; |
||
Line 185: | Line 134: | ||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
</div> |
Latest revision as of 11:12, 23 August 2022
45° Strafeとは、通常よりも高い速度を得られる技術である。
前進キーとstrafeキーを入力し、45°方向を向くことで実行できる(名前の由来はそこから)。
45° Strafeは以下のどちらでも可能:
- 左45°に振り向き、右Strafeキーを入力。
- 右45°に振り向き、左Strafeキーを入力。
振り向きは素早く(1tick以内)かつ正確(誤差最大±11.5°、±0°に近いほど良い)でなければならないため、安定して実行するのは難しい。
1bm 4.375bなど、45° strafeが必須のジャンプも存在する。
動きへの影響
毎tick、プレイヤーはキー入力などの要素に基づいた加速度を得る。
- 正面に(strafe入力なしで)動いている場合、得られる加速度は倍になる。
- strafe入力ありの場合、加速度は倍になる。
よって、45° Strafeは通常の移動方法よりも倍(約2%)速い。
特殊なケース: 45°スニーク
- 正面に(strafe入力なしで)スニークしている場合、得られる加速度は倍になる。
- strafe入力ありの場合、得られる加速度は(≒ 1.386)倍になる。
45°スニークは助走なしジャンプに使用される(例)。
通常のスニークよりも約41%速いため、bridgingなどアスレチック以外でも使用されている。
解説
以下は水平方向の移動に関するソースコードを簡略化したもの。
/*
* EntityとEntityLivingBaseのソースコード
* 不要、無関係な部分は削除済
*/
public void onLivingUpdate()
{
/*
* moveStrafingとmoveForwardは相対的な動きを表す。
* moveStrafing = 左に動いている場合1.0、右に動いている場合-1.0、それ以外は0.0。
* moveForward = 前に動いている場合1.0、後ろに動いている場合-1.0、それ以外は0.0。
*
* 更に、スニークしている場合、moveStrafingとmoveForward *= 0.3。
*/
this.moveStrafing *= 0.98F;
this.moveForward *= 0.98F;
this.moveEntityWithHeading(this.moveStrafing, this.moveForward);
}
public void moveEntityWithHeading(float strafe, float forward)
{
/* 次tickに保持される速度は慣性によって決定される */
float mult = 0.91F;
if (this.onGround)
{
/* プレイヤーの1b下のブロックの滑りやすさを取得 */
mult *= getBlockSlipperinessAt(this.posX, this.getEntityBoundingBox().minY - 1, this.posZ);
}
/* 加速度 = (0.6*0.91)^3 / (滑りやすさ*0.91)^3) */
float acceleration = 0.16277136F / (mult * mult * mult);
float movementFactor;
if (this.onGround)
movementFactor = this.landMovementFactor * acceleration;
/* 基本加速度: 0.1; ダッシュしている場合x1.3で、ステータス効果の影響を受ける。 */
else
movementFactor = this.airMovementFactor;
/* 基本加速度: 0.02; ダッシュしている場合x1.3。 */
this.updateMotionXZ(strafe, forward, movementFactor);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionY -= 0.08D; /* 重力 */
this.motionY *= 0.98D; /* 抗力 */
this.motionX *= mult;
this.motionZ *= mult;
}
public void updateMotionXZ(float strafe, float forward, float movementFactor)
{
/*
* この関数が45° strafeが存在する原因。この世界では幾何学には何の意味もない……。
* 注:
* - ダッシュの倍率は「movementFactor」の中。
* - スニークの倍率は「strafe」と「forward」の中。
* これは、スニークがダッシュより遥か以前に実装されたためと思われる。
*/
float distance = strafe * strafe + forward * forward;
if (distance >= 1.0E-4F)
{
distance = MathHelper.sqrt_float(distance);
if (distance < 1.0F)
distance = 1.0F;
distance = movementFactor / distance;
strafe = strafe * distance;
forward = forward * distance;
float sinYaw = MathHelper.sin(this.rotationYaw * Math.PI / 180.0F);
float cosYaw = MathHelper.cos(this.rotationYaw * Math.PI / 180.0F);
this.motionX += strafe * cosYaw - forward * sinYaw;
this.motionZ += forward * cosYaw + strafe * sinYaw;
}
}