Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created July 4, 2018 09:08
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/4e931b10b1c72d3f9e5303da32ea3740 to your computer and use it in GitHub Desktop.
Save todorok1/4e931b10b1c72d3f9e5303da32ea3740 to your computer and use it in GitHub Desktop.
MathfのRad2Degを使って角度の変換
void Rad2DegCheck(){
// 弧度法で表した角度を度数法に変換
float radAngle45 = 1.0f / 4.0f * Mathf.PI;
float radAngle90 = 1.0f / 2.0f * Mathf.PI;
float radAngle180 = Mathf.PI;
float radAngle360 = 2.0f * Mathf.PI;
float degAngle45 = radAngle45 * Mathf.Rad2Deg;
float degAngle90 = radAngle90 * Mathf.Rad2Deg;
float degAngle180 = radAngle180 * Mathf.Rad2Deg;
float degAngle360 = radAngle360 * Mathf.Rad2Deg;
Debug.Log(radAngle45 + "radを変換すると " + degAngle45 + " 度。");
Debug.Log(radAngle90 + "radを変換すると " + degAngle90 + " 度。");
Debug.Log(radAngle180 + "radを変換すると " + degAngle180 + " 度。");
Debug.Log(radAngle360 + "radを変換すると " + degAngle360 + " 度。");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment