角度

From Minecraft Parkour Wiki
This page is a translated version of the page Angles and the translation is 33% complete.
Other languages:

このページはマウス移動の続編となっており、Minecraft内で三角関数がどのように機能するかに焦点を当てている。


プレイヤーのyawは、水平方向の回転(単位は度)を記録する浮動小数点数である。値の範囲は制限されていない

プレイヤーのfacingは、F3画面内に表示される通り、yawを[-180°,180°]の範囲に制限した値である。

significant angleもしくは単に角度は、整数の値である(範囲はから)。



Significant Angles

Minecraft relies on significant angles for its trigonometry, which means the player's yaw has to be converted to an angle.

This conversion induces imprecision: a significant angle spans across ~).


Sin()とCos()のソースコード(MathHelperクラスから):

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


public static float sin(float value) //単位はラジアン
{
    return SIN_TABLE[(int)(value * 10430.378F) & 65535];
}

public static float cos(float value) //単位はラジアン
{
    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);
    }
}

注: & 65535は65536()で割った(正の)余りを返す。
プレイヤーのyawをラジアンに変換するために(sinとcosを呼び出す際)、ゲームは2つの式を使用する:

//一般に使われる式
f = this.rotationYaw * (float)Math.PI / 180.0F

//ダッシュジャンプのブーストを付与する際の式
f = this.rotationYaw * 0.017453292F

どちらも目的は同じだが、値が大きい場合には結果が異なる場合がある。

In that case, sprintjumping moves the player slightly to the side, which may be useful for no-turn strats.

Half Angle

(int)(value * 10430.378F) and (int)(value * 10430.378F + 16384.0F) should be 16384 units apart (90°), but because of floating point imprecision, some values could end up 1 or more units further, causing a slight shift from the intended calculation.

Two consecutive angles (30237 and 30238) and a positive half angle in between.
Half angles are such values, and can be found "between" consecutive angles (hence the name).

The existence of half angles is entirely due to the fact the term "+ 16384" is inside the parentheses.


Half angles don't have much use outside of Tool-Assisted Parkour: their effect on jump distance is small, and they are hardly usable with real-time mouse movement.


Each half-angle has an associated Multiplier that represents its effectiveness.

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.