Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created July 4, 2018 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todorok1/52c32a032f6bb5eda1782f72cb8eabb4 to your computer and use it in GitHub Desktop.
Save todorok1/52c32a032f6bb5eda1782f72cb8eabb4 to your computer and use it in GitHub Desktop.
MathfのDeg2Radを使って角度の変換
public class DegRadCheck : MonoBehaviour {
void Start(){
Deg2RadCheck();
}
void Deg2RadCheck(){
// 度数法で表した角度を弧度法に変換
float degAngle45 = 45f;
float degAngle90 = 90f;
float degAngle180 = 180f;
float degAngle360 = 360f;
float radAngle45 = degAngle45 * Mathf.Deg2Rad;
float radAngle90 = degAngle90 * Mathf.Deg2Rad;
float radAngle180 = degAngle180 * Mathf.Deg2Rad;
float radAngle360 = degAngle360 * Mathf.Deg2Rad;
Debug.Log(degAngle45 + "度を変換すると " + radAngle45 + " rad。");
Debug.Log(degAngle90 + "度を変換すると " + radAngle90 + " rad。");
Debug.Log(degAngle180 + "度を変換すると " + radAngle180 + " rad。");
Debug.Log(degAngle360 + "度を変換すると " + radAngle360 + " rad。");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment