Skip to content

Instantly share code, notes, and snippets.

@todorok1
Last active July 3, 2018 08:50
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/d77396093a59a9a8318212510a7bb150 to your computer and use it in GitHub Desktop.
Save todorok1/d77396093a59a9a8318212510a7bb150 to your computer and use it in GitHub Desktop.
MathfのFloorを使った時の動作
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