Mouse Movement/ja: Difference between revisions
(Created page with "これは、視点の移動は0.15°刻みであることを意味する: 45°振り向くには、マウスを300px動かす必要がある。") |
No edit summary |
||
(37 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
<span id="Sensitivity"></span> |
|||
== マウス感度 == |
== マウス感度 == |
||
マウス感度('''s''')は、視点の回転速度を変更するパラメーター。 |
マウス感度('''s''')は、視点の回転速度を変更するパラメーターである。 |
||
操作設定のメニューから変更できる。 |
操作設定のメニューから変更できる。 |
||
Line 28: | Line 29: | ||
デフォルトのマウス感度(<math display="inline">s=0.5</math>)では、1ピクセルのマウス移動は0.15°の回転に変換される。 |
デフォルトのマウス感度(<math display="inline">s=0.5</math>)では、1ピクセルのマウス移動は0.15°の回転に変換される。 |
||
これは、視点の移動 |
これは、視点の移動が0.15°刻みであることを意味する: 45°振り向くには、マウスを300px動かす必要がある。 |
||
また、厳密には'''s'''は[0,1]の範囲に制限されておらず、任意の値を取ることができる(負の値も含む)。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
Furthermore, '''s''' isn't technically bounded by [0,1], and can take any value (even negative). |
|||
</div> |
|||
この値は、options.txtファイル(.minecraft内)のmouseSensitivityの値を手動で編集することで変更できる。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
You can manually edit the value of mouseSensitivity in the options.txt file (found in the .minecraft folder) |
|||
</div> |
|||
サーバーによってはoptions.txtファイルの改変が許可されていない場合があるため、注意されたい。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
Be warned that modifying the options.txt file may or may not be allowed on servers. |
|||
</div> |
|||
<span id="Remarkable_values"></span> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
== |
== 特筆すべき値 == |
||
</div> |
|||
マウス感度は任意の値に設定できるため、回転の刻み幅が特定の角度になるようマウス感度を調整するのも興味深いだろう。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
Since it's possible to set the sensitivity to any value we want, it might be interesting to adjust the sensitivity to match specific rotation increments. |
|||
</div> |
|||
目的の刻み幅に必要なマウス感度<math display="inline">\delta</math>は、次の逆公式によって求められる: |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
To get the required sensitivity for the desired increment <math display="inline">\delta</math>, we can use the inverse formula: |
|||
</div> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
<math>s = \frac{\sqrt[3]{\frac{\delta}{1.2}} - 0.2}{0.6}</math> |
<math>s = \frac{\sqrt[3]{\frac{\delta}{1.2}} - 0.2}{0.6}</math> |
||
<br /> |
<br /> |
||
</div> |
|||
以下の表は、特筆すべき回転の刻み幅と、それに対応する'''s'''の値の一覧。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
This table lists remarkable increments of rotation, and the corresponding values of '''s'''. |
|||
{| class="wikitable" |
{| class="wikitable" |
||
!<math display="inline">\delta</math> |
!<math display="inline">\delta</math> |
||
Line 94: | Line 81: | ||
|8.5221547 |
|8.5221547 |
||
|}<br /> |
|}<br /> |
||
</div> |
|||
<span id="Yaw_and_Pitch"></span> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
== Yaw |
== YawとPitch == |
||
</div> |
|||
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 浮動小数点数]である。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
Yaw (horizontal rotation) and pitch (vertical rotation) are [https://en.wikipedia.org/wiki/Floating-point_arithmetic floats] that keep track of an entity's head rotation. |
|||
</div> |
|||
[[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"> |
|||
<syntaxhighlight lang="java"> |
|||
/* |
/* EntityRenderer.java内 */ |
||
public void updateMouseMovement(...) |
public void updateMouseMovement(...) |
||
{ |
{ |
||
... // |
... //前のソースコードは無視 |
||
</div> |
|||
⚫ | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
⚫ | |||
float mult = f * f * f * 8.0F; |
float mult = f * f * f * 8.0F; |
||
float dX = (float)this.mc.mouseHelper.deltaX * mult; |
float dX = (float)this.mc.mouseHelper.deltaX * mult; |
||
float dY = (float)this.mc.mouseHelper.deltaY * mult; |
float dY = (float)this.mc.mouseHelper.deltaY * mult; |
||
</div> |
|||
⚫ | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
⚫ | |||
if (this.mc.gameSettings.invertMouse) |
if (this.mc.gameSettings.invertMouse) |
||
i = -1; |
i = -1; |
||
</div> |
|||
... //滑らかなカメラ動作が有効の場合フィルタを適用 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
... //Applies filters if smooth camera |
|||
</div> |
|||
⚫ | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
⚫ | |||
} |
} |
||
</div> |
|||
⚫ | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
⚫ | |||
public void rotateEntity(float dX, float dY) |
public void rotateEntity(float dX, float dY) |
||
{ |
{ |
||
Line 148: | Line 119: | ||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
</div> |
|||
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> |
|||
⚫ | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
* |
* <math>|yaw| > 8388608</math> (<math display="inline">2^{23}</math>) で、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> |
|||
⚫ | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
⚫ | |||
</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
マウス移動は、画面上でのマウスカーソルの瞬間的な移動量を表す(単位はピクセル/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° | -0.3333333 |
0.1° | 0.3946504 |
0.15° | 0.5 |
0.25° | 0.6546926 |
0.5° | 0.9115013 |
1° | 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の値が大きくなりすぎて、適切に角度の値に変換できなくなるため(角度を参照)。
この現象は、の場合に起こる。
では、更に振り向くとゲームがクラッシュする場合がある。