Mouse Movement/ja: Difference between revisions

From Minecraft Parkour Wiki
Content added Content deleted
No edit summary
No edit summary
 
(17 intermediate revisions by the same user not shown)
Line 7: Line 7:




<span id="Sensitivity"></span>
== マウス感度 ==
== マウス感度 ==


Line 41: Line 42:




<span id="Remarkable_values"></span>
== 注目すべき値 ==
== 特筆すべき値 ==


マウス感度は任意の値に設定できるため、回転の刻み幅が特定の角度になるようマウス感度を調整するのも興味深いだろう。
マウス感度は任意の値に設定できるため、回転の刻み幅が特定の角度になるようマウス感度を調整するのも興味深いだろう。
Line 50: Line 52:
<br />
<br />


以下の表は、注目すべき回転の刻み幅と、それに対応する'''s'''の値の一覧。
以下の表は、特筆すべき回転の刻み幅と、それに対応する'''s'''の値の一覧。
{| class="wikitable"
{| class="wikitable"
!<math display="inline">\delta</math>
!<math display="inline">\delta</math>
Line 80: Line 82:
|}<br />
|}<br />


<span id="Yaw_and_Pitch"></span>
== YawとPitch ==
== YawとPitch ==


Yaw(水平方向の回転)とpitch(垂直方向の回転)は、エンティティの頭部の回転を記録する[https://ja.wikipedia.org/wiki/%E6%B5%AE%E5%8B%95%E5%B0%8F%E6%95%B0%E7%82%B9%E6%95%B0 浮動小数点数]である。
Yaw(水平方向の回転)とpitch(垂直方向の回転)は、エンティティの頭部の回転を記録する[https://ja.wikipedia.org/wiki/%E6%B5%AE%E5%8B%95%E5%B0%8F%E6%95%B0%E7%82%B9%E6%95%B0 浮動小数点数]である。


[[Special:MyLanguage/Facing and Angles/ja|Facing]]は、[[Special:MyLanguage/Debug Screen/ja|F3画面]]内に表示される通り、yawを[-180,180]の範囲に制限した値である。Pitchの値は元来から[-90,90]の範囲に制限されている。
<div lang="en" dir="ltr" class="mw-content-ltr">
[[Special:MyLanguage/Facing and Angles|Facing]] is the restriction of the yaw to [-180, 180], as it is represented in [[Special:MyLanguage/Debug Screen|F3]]. Pitch is naturally clamped between [-90, 90].
</div>


プレイヤーのyawとpitchはマウスの移動によって直接変更される:
<div lang="en" dir="ltr" class="mw-content-ltr">
Mouse movement directly modifies the player's yaw and pitch:<syntaxhighlight lang="java">
<syntaxhighlight lang="java">
/* In EntityRenderer.java */
/* EntityRenderer.java */
public void updateMouseMovement(...)
public void updateMouseMovement(...)
{
{
... //previous code ignored
... //前のソースコードは無視
</div>


float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
Line 122: Line 122:




pitchの値は-90°から90°に制限されているが、予想される通り、yawの値は-180°から180°には制限されていない。
<div lang="en" dir="ltr" class="mw-content-ltr">
While the pitch is clamped between -90° and 90°, yaw is not restricted between -180° and 180° as would be expected.
</div>


すなわち、'''yawの値は際限なく増えていく'''。意図的に一方向に振り向き続けると、予期せぬ影響がある。
<div lang="en" dir="ltr" class="mw-content-ltr">
This means that '''yaw is unbounded''', which has some unintended consequences if you deliberately turn in one direction for long enough.
</div>




浮動小数点数の性質上、値が大きくなるほど精度が落ち、巨大な値では目に見えて不安定になる。
<div lang="en" dir="ltr" class="mw-content-ltr">
By nature of being a float, its precision becomes worse the bigger it gets, to the point where it becomes noticeably jittery at large values.
</div>


* <math>|yaw| > 4194304</math> (<math display="inline">2^{22}</math>) で、0.5°刻みでしか増加しなくなる。
<div lang="en" dir="ltr" class="mw-content-ltr">
* When <math>|yaw| > 4194304</math> (<math display="inline">2^{22}</math>) it can only increase in increments of 0.5°.
* <math>|yaw| > 8388608</math> (<math display="inline">2^{23}</math>) で、1°刻みでしか増加しなくなる。
* When <math>|yaw| > 8388608</math> (<math display="inline">2^{23}</math>) it can only increase in increments of 1°.
</div>






ある時点で、プレイヤーの動きがYawの干渉を受け、[https://youtu.be/DEI_CeFlatM 一点から動けなくなる]こともある。
<div lang="en" dir="ltr" class="mw-content-ltr">
At some point, yaw can even [https://youtu.be/DEI_CeFlatM mess with movement and stop the player in place].
</div>


これは、yawの値が大きくなりすぎて、適切に角度の値に変換できなくなるため([[Special:MyLanguage/Angles|角度]]を参照)。
<div lang="en" dir="ltr" class="mw-content-ltr">
This is because the yaw gets too large to be converted to a proper angle (see [[Special:MyLanguage/Angles|Angles]]).
</div>


この現象は、<math>|yaw| \geq 11796480 = 360 \times 2^{15}</math>の場合に起こる。
<div lang="en" dir="ltr" class="mw-content-ltr">
This phenomenon happens when <math>|yaw| \geq 11796480 = 360 \times 2^{15}</math>.
</div>




<math display="inline">|yaw| > 8.59 \times 10^9</math>では、更に振り向くとゲームがクラッシュする場合がある。
<div lang="en" dir="ltr" class="mw-content-ltr">
Turning even further can crash the game, when <math display="inline">|yaw| > 8.59 \times 10^9</math>
</div>

Latest revision as of 10:37, 11 September 2023

Other languages:

マウス移動は、画面上でのマウスカーソルの瞬間的な移動量を表す(単位はピクセル/px): ()。

Minecraftにおいては、マウス移動は視点の瞬間的な回転量を表す(単位は度):()。



マウス感度

マウス感度(s)は、視点の回転速度を変更するパラメーターである。

操作設定のメニューから変更できる。

  • デフォルトのマウス感度は「100%」(
  • バニラでの最低感度は「0%」(
  • バニラでの最高感度は「200%」(


1.8では、は次のように計算される:

も同様に求められ、「マウス操作の反転」の設定がオンの場合は-1倍される。


デフォルトのマウス感度()では、1ピクセルのマウス移動は0.15°の回転に変換される。

これは、視点の移動が0.15°刻みであることを意味する: 45°振り向くには、マウスを300px動かす必要がある。


また、厳密にはsは[0,1]の範囲に制限されておらず、任意の値を取ることができる(負の値も含む)。

この値は、options.txtファイル(.minecraft内)のmouseSensitivityの値を手動で編集することで変更できる。

サーバーによってはoptions.txtファイルの改変が許可されていない場合があるため、注意されたい。



特筆すべき値

マウス感度は任意の値に設定できるため、回転の刻み幅が特定の角度になるようマウス感度を調整するのも興味深いだろう。

目的の刻み幅に必要なマウス感度は、次の逆公式によって求められる:


以下の表は、特筆すべき回転の刻み幅と、それに対応するsの値の一覧。

s
-0.3333333
0.1° 0.3946504
0.15° 0.5
0.25° 0.6546926
0.5° 0.9115013
1.2350600
45° 5.2452746
180° 8.5221547


YawとPitch

Yaw(水平方向の回転)とpitch(垂直方向の回転)は、エンティティの頭部の回転を記録する浮動小数点数である。

Facingは、F3画面内に表示される通り、yawを[-180,180]の範囲に制限した値である。Pitchの値は元来から[-90,90]の範囲に制限されている。

プレイヤーのyawとpitchはマウスの移動によって直接変更される:

/* EntityRenderer.java内 */
public void updateMouseMovement(...)
{
    ... //前のソースコードは無視

    float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
    float mult = f * f * f * 8.0F;
    float dX = (float)this.mc.mouseHelper.deltaX * mult;
    float dY = (float)this.mc.mouseHelper.deltaY * mult;

    int i = 1;
    if (this.mc.gameSettings.invertMouse)
        i = -1;

    ... //滑らかなカメラ動作が有効の場合フィルタを適用

    this.mc.thePlayer.rotateEntity(dX, dY*i);
}


/* Entity.java内 */
public void rotateEntity(float dX, float dY)
{
    this.rotationYaw = this.rotationYaw + dX*0.15);
    this.rotationPitch = this.rotationPitch - dY*0.15;
    this.rotationPitch = MathHelper.clamp(this.rotationPitch, -90.0, 90.0);
}


pitchの値は-90°から90°に制限されているが、予想される通り、yawの値は-180°から180°には制限されていない。

すなわち、yawの値は際限なく増えていく。意図的に一方向に振り向き続けると、予期せぬ影響がある。


浮動小数点数の性質上、値が大きくなるほど精度が落ち、巨大な値では目に見えて不安定になる。

  • () で、0.5°刻みでしか増加しなくなる。
  • () で、1°刻みでしか増加しなくなる。


ある時点で、プレイヤーの動きがYawの干渉を受け、一点から動けなくなることもある。

これは、yawの値が大きくなりすぎて、適切に角度の値に変換できなくなるため(角度を参照)。

この現象は、の場合に起こる。


では、更に振り向くとゲームがクラッシュする場合がある。