Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created April 13, 2018 10:07
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/1e4bfb024acda9b5d37140a35db86a60 to your computer and use it in GitHub Desktop.
Save todorok1/1e4bfb024acda9b5d37140a35db86a60 to your computer and use it in GitHub Desktop.
Unityチュートリアル・ボールの飛距離をゲーム画面に表示するスクリプト。
void CheckDistance(){
if (!isCheckingDistance){
// 距離測定中でなければ何もしない
return;
}
if (rb.IsSleeping()){
// スリープモードに入ったことを検知したら距離を出力
stopPosition = gameObject.transform.position;
float distance = GetDistanceInXZ(initPosition, stopPosition);
// UIテキストに表示
SetDistanceText(distance);
// 距離測定中フラグをオフに
isCheckingDistance = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment