Sin in degrees

Unity does Sin Cos etc in radians, how can I get a degree result for something like

Mathf.sin(direction)

Thanks

Hi,

I’m not exactly sure what you are doing, but there exists conversions for radians (from/to):

So I’ve been trying that. this is what I had to get the degree answer for sin 180 (which should be 0)

movement = Mathf.Sin(180 * Mathf.Rad2Deg);
//and I also tried this
movement = Mathf.Sin(180) * Mathf.Rad2Deg;

I don’t really know what to do… guess I’ll keep working on it

Ok figured this out! thanks for the reply, apparently I’m stupid or something idk :stuck_out_tongue:

@PhaseOne

Well if you figured it out, why not share the solution here…

oh ok

movement = Mathf.Sin(direction * Mathf.Deg2Rad);

I realized that my direction was in degrees (along with the rigidbody 2d “rotation”) so I needed to convert the degrees into radians, where before I was trying to convert my 180 “radians” into degrees, which they already were.

if that makes any sense