Angles: Difference between revisions

From Minecraft Parkour Wiki
Content added Content deleted
(complete)
mNo edit summary
Line 56: Line 56:




<math display="inline">M=\sqrt{\cos(F)^{2}+\sin(F)^{2}}</math>
<math display="inline">\left \|\vec{v}\right \|=\sqrt{\cos(F)^{2}+\sin(F)^{2}}</math>





Revision as of 19:15, 7 March 2020

The Player's yaw (facing) is a float (from to ).

An angle is an integer (from to ).


Angles

Minecraft relies on angles for movement calculations, which means the Player's yaw has to be converted before being used.

This conversion induces some imprecision, as information is lost when casting a float to an int.

This also means two close (but different) facings can result in the same significant angle being used (a single angle spans across ~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() source code (from 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 gives the (positive) remainder of a division by 65536 ( )


Half Angles

Ideally, (int)(value * 10430.378F) and (int)(value * 10430.378F + 16384.0F) would be 16384 units apart (90°). But because of float imprecision, some values could be further by 1 unit, causing a slight shift from the intended calculation.

Half angles are such values, and can found "between" consecutive angles (hence the name).


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

  • Positive half-angles increase the Player's speed. They can be found (rarely) in the North-West quadrant (90° to 180°)
  • Negative half-angles decrease the Player's speed. They can be found (abundantly) in the South-East quadrant (-90° to 0°), as well as in the South-West quadrant (0° to 90°) in rare amounts.
Graph showing the relative effect of Half Angles. A multiplier above 1 indicates a positive half angle.


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 in that doesn't hold true in the context of half-angles.



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

  • A multiplier above 1.0 indicates a positive half angle. (increased speed)
  • A multiplier below 1.0 indicates a negative half angle. (decreased speed)
  • A multiplier equal to 1.0 indicates a regular angle. (no effects on speed)


List of all positive Half Angles


Two consecutive angles (30237 and 30238) and a positive half angle in between.


Note: Fast Math is an Optifine feature that reduces the number of angles to 4096 ( ). With Fast Math, half angles are fewer in number, but are up to 16x more effective. For example, it makes a no-sprint 3b jump possible with only flat momentum.