Search Unity

Joints

Discussion in 'Physics' started by SansElBoludo, Sep 7, 2019.

  1. SansElBoludo

    SansElBoludo

    Joined:
    Jul 9, 2019
    Posts:
    1
    I need help. I have a game where a spaceship has a claw to pick up rocks,
    and I want to do that with a 2D joint but when i want it to detach i use this:
    Code (CSharp):
    1. Rigidbody2D Target;
    2. HingeJoint2D Jointy;
    3.  
    4. void Update()
    5. {
    6.      if(!Input.GetButton("Grab")  && Target != null)
    7.      {
    8.          Destroy(Jointy);
    9.      }
    10. }
    but it does nothing.

    also if i make it destroy through GetComponent<HingeJoint2D> it will detach also from the spaceship