Angles

From Minecraft Parkour Wiki
Revision as of 17:47, 22 February 2020 by MCPK (talk | contribs) (created page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

a

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

An angle is an integer (from to)


A single angle spans approximately 0.0055°


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

This conversion induces some imprecision.


Trigonometric functions: (from MathHelper):

public class 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);
        }
    }
}