private IEnumerator PhysicsSwing() { //TODO: use Rigidbody.MoveRotation instead GetComponent <Rigidbody> ().AddForce(batForce); GetComponent <Rigidbody> ().AddRelativeTorque(batTorque, ForceMode.Acceleration); //旋轉 //-y 90度 z 25度 yield return(new WaitForSeconds(swingDuration)); originalTransform.Set(this.gameObject); AfterSwing(); }
public void Reset() { Debug.Log("Reset ball"); GetComponent <TrailRenderer> ().Clear(); GetComponent <Rigidbody> ().useGravity = false; startTransform.Set(this.gameObject); isHit = false; Stop(); state = new PitchState(this); angleText.text = ""; distanceText.text = ""; }
public void Reset() { startTransform.Set(this.gameObject); Enable(); }