コード例 #1
0
 public void Detach()
 {
     gameObject.AddComponent <Rigidbody> ();
     working  = false;
     attached = false;
     GetComponent <Rigidbody> ().velocity = plane.GetComponent <Rigidbody> ().velocity;
     collider.enabled = true;
 }
コード例 #2
0
 /// Detach the part from the parent rigidbody
 public void Detach()
 {
     gameObject.AddComponent <Rigidbody> ();
     working  = false;
     attached = false;
     //If it's from a plane, inherit the plane's speed
     if (plane != null)
     {
         GetComponent <Rigidbody> ().velocity = plane.GetComponent <Rigidbody> ().velocity;
     }
     //Otherwise add a random torque
     else
     {
         GetComponent <Rigidbody>().AddTorque(new Vector3(Random.Range(0, 10), Random.Range(0, 10), Random.Range(0, 10)));
     }
     collider.enabled = true;
     health           = -1;
 }