how to properly use mathf cosinus?

what ever I do I get totally wrong resault

http://www.mathsisfun.com/geometry/unit-circle.html

  • cos 0.5f should be 60°
  • cos 0 should be 90°

but they aren’t:

Debug.Log(Mathf.Cos(0.5f) ); // 50.28178
Debug.Log(Mathf.Cos(0f) );   // 1
Debug.Log(Mathf.Cos(0.5f) * Mathf.Deg2Rad); // 0.01745329
Debug.Log(Mathf.Cos(0.5f) * Mathf.Rad2Deg); // 57.29578

so what am I doing wrong?

The result of cos is always from -1 to 1. I think you want Mathf.Acos

Cos (60) = 0.5

Cos^-1 (0.5) = 60

This is in degrees/

Math.f functions work in Radians

Take Degrees x Pi/180 to find radians.