Unity does Sin Cos etc in radians, how can I get a degree result for something like Code (CSharp): Mathf.sin(direction) Thanks
Hi, I'm not exactly sure what you are doing, but there exists conversions for radians (from/to): https://docs.unity3d.com/ScriptReference/Mathf.Deg2Rad.html https://docs.unity3d.com/ScriptReference/Mathf.Rad2Deg.html
So I've been trying that. this is what I had to get the degree answer for sin 180 (which should be 0) Code (CSharp): 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
oh ok Code (CSharp): 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