Player movement in the direction of rotation INACCURATE?

So I have just wrote a code that moves the player in the direction of his “face”/rotation but for some reason it works really inaccurately. For example when I am, the player is facing a 45 degrees angle it moves in 35-40 degrees angle. Can someone help me fix it? Thanks ^^

void Update()
    {
        Angle = Rigid.rotation.y;
        
        if (Input.GetButton("Vertical"))
        {
            Rigid.MovePosition(Rigid.position + new Vector3(0.02f * Input.GetAxis("Vertical")*Mathf.Sin(Angle*Mathf.PI), 0 , 0.02f * Input.GetAxis("Vertical") * Mathf.Cos(Mathf.PI * Angle)));
        }
        
    }

Angle = Rigid.rotation.y;
Rigidbody.rotation.y is not an angle, partner. It’s an imaginary component of a quaternion.

As @andrew-lukasik said, rotation.y does not return an angle, it returns the Y component of a Quaternion and they don’t really work as angles. If you do actually want to get the angle that the Player has been rotated towards you can use the [EulerAngles] 1, which actually return angles.
Also, though I don’t know if you might have considered this, you can get the forward, up and right axis of a transform, so if all you wanna do is move the player in the direction it is facing towards, you could just take the [transform.forward] 2 and multiply it by Input.GetAxis("Vertical") . Hope it helps :smiley:

this will turn your character cleanly, just set a float aimspeed to how fast you want to turn

if (Input.GetButton(“Vertical”))
{
transform.Rotate(Vector3.up * aimSpeed * Input.GetAxis(“Vertical”) * Time.deltaTime);
}