Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice


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

  1. SansElBoludo


    Jul 9, 2019
    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;
    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