Convert Mathf.Sin() radians to degrees

Hi.

I need to display some calculations on my screen, and I want to show some of them in degrees. The problem is taht unity calculates perfectly sin and cos in radians but I cant get it to convert them properly to degrees.

I’ve used the Rad2Deg variable, and even try it by the “manual way” like this:

cosOps=(360Mathf.Sin(45))/2Mathf.PI;

Thanks for the help!

It’s looking for the parameter of Mathf.Sin to be in radians. The return value is going to be the resulting sin value. Mathf.Asin will return an angle in radians from a sin.

EDIT

Ok I’m going to try this again!

If you want to be able to input angles in degrees then you need to convert the angle you input into radians before getting the sine of the angle.

  var myAngleInDegrees = 175;
  var sinOfAngle = Mathf.Sin((myAngleInDegrees * Mathf.PI)/180);

if you have the sine of an angle and you want the angle in degrees

   var mySineOfAngle = 0.4;
   var angleOfSineInDegrees = (Mathf.ASin(mySineOfAngle) * 180) / Mathf.PI;

PI by 180 or 180 by PI is the ratio to use. General rule , if it is a big number ( 0 to 360) divide by 180, if it is small number (-1 to 1) multiply by 180.

angleDeg = 45f; angleRad = angleDeg * PI / 180;

sinAngleRad = Mathf.Sin(angleRad);
sinAngleDeg = sinAngleRad*180/PI;