Mouse Movement/zh: Difference between revisions
(Created page with "在默认灵敏度下(<math display="inline">s=0.5</math>),鼠标移动一个像素转换为0.15°旋转。") |
(Created page with "这意味着视角以0.15°的增量移动:如果要转45°,则需要移动鼠标300px。") |
||
Line 28: | Line 28: | ||
在默认灵敏度下(<math display="inline">s=0.5</math>),鼠标移动一个像素转换为0.15°旋转。 |
在默认灵敏度下(<math display="inline">s=0.5</math>),鼠标移动一个像素转换为0.15°旋转。 |
||
这意味着视角以0.15°的增量移动:如果要转45°,则需要移动鼠标300px。 |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
|||
This means that the camera moves in increments of 0.15°: to turn 45°, you would need to move your mouse by 300px. |
|||
</div> |
|||
此外,'''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> |
|||
Line 53: | Line 45: | ||
</div> |
</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> |
|||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
<div lang="en" dir="ltr" class="mw-content-ltr"> |
Revision as of 11:29, 1 October 2021
鼠标移动表示光标在屏幕上的瞬时位移(以像素为单位): ()。
在《我的世界》中,鼠标移动代表视角的即时旋转(以角度表示): ()。
灵敏度
灵敏度(s)是一个参数,用于改变视角的旋转速度。
可以在“控制”菜单中更改此设置。
- 默认灵敏度为"100%" ()
- 原版中最低的灵敏度是"0%" ()
- 原版中最高的灵敏度是"200%" ()
在1.8中, 计算如下:
以同样的方式获得,如果打开了“鼠标反转”,则乘以-1。
在默认灵敏度下(),鼠标移动一个像素转换为0.15°旋转。
这意味着视角以0.15°的增量移动:如果要转45°,则需要移动鼠标300px。
此外,s理论上并不受 [0,1] 的限制,它可以取任何值(甚至是负值)
您可以在 options.txt ( .minecraft 文件夹中)中手动编辑 mouseSensitivity 的值
请注意,服务器上可能允许也可能不允许修改 options.txt 文件。
Remarkable values
由于可以将灵敏度设置为我们想要的任何值,因此调整灵敏度以匹配特定的旋转增量可能会很有趣。
To get the required sensitivity for the desired increment , we can use the inverse formula:
This table lists remarkable increments of rotation, and the corresponding values of 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 and Pitch
Yaw (horizontal rotation) and pitch (vertical rotation) are floats that keep track of an entity's head rotation.
Facing is the restriction of the yaw to [-180, 180], as it is represented in F3. Pitch is naturally clamped between [-90, 90].
/* In EntityRenderer.java */
public void updateMouseMovement(...)
{
... //previous code ignored
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
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;
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
int i = 1;
if (this.mc.gameSettings.invertMouse)
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">
this.mc.thePlayer.rotateEntity(dX, dY*i);
}
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
/* In 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);
}
While the pitch is clamped between -90° and 90°, yaw is not restricted between -180° and 180° as would be expected.
This means that yaw is unbounded, which has some unintended consequences if you deliberately turn in one direction for long enough.
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.
- When () it can only increase in increments of 0.5°.
- When () it can only increase in increments of 1°.
At some point, yaw can even mess with movement and stop the player in place.
This is because the yaw gets too large to be converted to a proper angle (see Angles).
This phenomenon happens when .
Turning even further can crash the game, when