Last active
July 3, 2018 08:50
-
-
Save todorok1/d77396093a59a9a8318212510a7bb150 to your computer and use it in GitHub Desktop.
MathfのFloorを使った時の動作
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void FloorTest(){ | |
float value = 3.46f; | |
Debug.Log("value : " + value + " / Floor : " + Mathf.Floor(value)); | |
Debug.Log("value : " + value + " / FloorToInt : " + Mathf.FloorToInt(value)); | |
value = -2.83f; | |
Debug.Log("value : " + value + " / Floor : " + Mathf.Floor(value)); | |
Debug.Log("value : " + value + " / FloorToInt : " + Mathf.FloorToInt(value)); | |
float flooredValue = Mathf.Floor(value); | |
// 明示的にキャストが必要 | |
int flooredIntValue = (int) Mathf.Floor(value); | |
float flooredToIntValueToFloat = Mathf.FloorToInt(value); | |
int flooredToIntValueToInt = Mathf.FloorToInt(value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment