Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.