Search Unity

"Disconnecting" a hinge-joint?

Discussion in 'Scripting' started by bigkahuna, Sep 30, 2007.

  1. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Is there another / better way to disconnect a hinge-joint? Right now what I'm doing is:

    Code (csharp):
    1. var myBody : Rigidbody;
    2.  
    3. function Update () {
    4.     hingeJoint.connectedBody = myBody;
    5. }
    ... and then setting "myBody" to the object's "self" in the inspector panel. Is there a better way? Can I -create- a hinge and then -destroy- it?

    Thanks...
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yep, Destroy() works with any component.

    --Eric
     
  3. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Thanks!