Skip to content

Instantly share code, notes, and snippets.

@todorok1
Last active April 13, 2018 03:55
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/38f0d8acad945ed97199ed69c21df543 to your computer and use it in GitHub Desktop.
Save todorok1/38f0d8acad945ed97199ed69c21df543 to your computer and use it in GitHub Desktop.
Unityチュートリアル・ボールの飛距離を計算するスクリプト。
void StopFlying(){
// 運動の停止
rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
// 初期位置に移動させる
gameObject.transform.position = initPosition;
// 距離測定中フラグをFalseにセット
isCheckingDistance = false;
}
void BoostSphere(){
// 向きと力の計算
Vector3 force = forceMagnitude * forceDirection;
// 力を加えるメソッド
rb.AddForce(force, ForceMode.Impulse);
// 距離測定中フラグをTrueにセット
isCheckingDistance = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment