Angles/zh: Difference between revisions

From Minecraft Parkour Wiki
Content added Content deleted
(Created page with "半角在工具辅助跑酷之外没有太大用处:它们对跳跃距离的影响很小,并且它们几乎无法用于实时鼠标移动。")
(Created page with "每个半角都有一个相关的'''乘数''',代表其效益。")
Line 71: Line 71:




每个半角都有一个相关的'''乘数''',代表其效益。
<div lang="en" dir="ltr" class="mw-content-ltr">
Each half-angle has an associated '''Multiplier''' that represents its effectiveness.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">

Revision as of 15:57, 11 September 2021

Other languages:

本文是鼠标运动的延续,重点介绍三角函数在Minecraft中的工作原理。


玩家的偏航角是一个浮点数,用于跟踪玩家的水平旋转(以度为单位)。它是无限的

玩家的朝向是将偏航角限制为[-180°, 180°],如F3所示。

有效角,或者简单地说,角度是一个整数 (从 )。



有效角

Minecraft 的三角函数依赖于有效角,这意味着玩家的偏航角必须转换为一个角度。

这种转换会导致不精准:一个有效角跨越 ~Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle 0.0055°} ).


Sin() and Cos() 原代码 (来自MathHelper):

private static final float[] SIN_TABLE = new float[65536];


public static float sin(float value) //in radians
{
    return SIN_TABLE[(int)(value * 10430.378F) & 65535];
}

public static float cos(float value) //in radians
{
    return SIN_TABLE[(int)(value * 10430.378F + 16384.0F) & 65535];
}


static
{
    for (int i = 0; i < 65536; ++i)
    {
        SIN_TABLE[i] = (float)Math.sin((double)i * Math.PI * 2.0D / 65536.0D);
    }
}

Note: & 65535给出除以 65536 的(正)余数() 为了将玩家的偏航转换为弧度(当调用sin和cos时),游戏使用了这两个公式:

//通用公式
f = this.rotationYaw * (float)Math.PI / 180.0F

////添加sprintjump boost时使用的公式
f = this.rotationYaw * 0.017453292F

两者都有相同的目的,但对于较大的值,结果可能不同。

在这种情况下,短跑跳跃将玩家稍微向一侧移动,这对于无转弯策略可能很有用。


半角

(int)(value * 10430.378F)(int)(value * 10430.378F + 16384.0F) 应该相隔 16384 个单位(90°),但由于浮点不精确,某些值可能会进一步相差 1 个或更多个单位,从而导致与预期计算的轻微偏移。

两个连续的角度(30237 和 30238)和中间的正半角。

半角 就是这样的值,可以在连续角的“中间”找到(因此得名)。

半角的存在完全是由于括号内的“+ 16384”。


半角在工具辅助跑酷之外没有太大用处:它们对跳跃距离的影响很小,并且它们几乎无法用于实时鼠标移动。


每个半角都有一个相关的乘数,代表其效益。

It corresponds to the norm of the unit vector obtained from cos(f) and sin(f).

Mathematically, it should always be equal to 1, but that doesn't hold true in this context.

  • "Increasing" half angles have a norm greater than 1: they increase movement speed.
  • "Decreasing" half angles have a norm lesser than 1: they decrease movement speed.




When multiplied with a given jump distance, it gives an upper bound for the improved jump distance with its corresponding half-angle.





Large Half Angles

On July 27th 2021, kemytz discovered that certain yaws grant more speed when using Optifine Fast Math (a feature which reduces the number of significant angles down to 4096). In fact, this is not specific to fast math, and vanilla "large half angles" were discovered soon after.

Large half angles are more effective due to the low amount of precision floats can work with at that range: instead of being shifted by a single unit, angles can be shifted by up to 64 units.

For example, the yaw 5898195° gives a multiplier of 1.003, which is huge compared to small half angles (135.0055° gives a multiplier of 1.00005). This half angle is the most effective that exists, and makes jumps such as 2.125bm 4+0.5 possible.

Reaching such high values may require using macros or mods, as turning manually would take too long.


With Fast Math, half angles are further amplified and the player is able to move while their yaw is less than , compared to in vanilla.

For example, the yaw 121000000° gives a multiplier of 1.09, which is so ludicrous it makes flat momentum 5b possible. This mechanic should not be considered official as it relies on a mod, and using this exploit is likely not authorized on servers (even if Optifine is).

New versions of Optifine changed the effect of fast math, which eliminated a lot of FM half angles (since version U L5, released in december 2019).


Characterization

Decreasing half angles are abundant between -90° and 0°, because negative floats are truncated up while positive floats are truncated down.

Decreasing half angles exist rarely between 0° and 90°.

Increasing half angles exist rarely between 90° and 180°.

Large half angles are of the form , with and . They are all increasing until , at which point they may either be increasing or decreasing.