- Home /
Destroy specific joints
Hey. I am creating a program that requires multiple FixerdJoints to be connected to one object. However, I cannot find a way to destroy a specific joint. Destroy(GetComponent<FixedJoint>());
will destroy every FixedJoint on that one game object. I need a way to destroy only one specific joint. Is there a way to destroy a specific joint by referring to its connectedBody? For example, I tried doing Destroy(GetComponent<FixedJoint>()).connectedBody = obj2Rb);
, but that ended up destroying the Rigidbody of obj2.
Did you manage to solve the problem? Im stuck on similar issue,did you manage to solve the problem? Im stuck on similar problem - trying to grab an item using joints and then destroy joint on input. However, its destroying all joints and removing limbs on robotic arm
Answer by edthered1009 · Feb 13, 2020 at 01:19 AM
I'd recommend adding a variable for a FixedJoint and then assigning it in the editor. Then you can simply go Destroy(jointVariable);
Hope this helps!
Your answer
![](https://koobas.hobune.stream/wayback/20220612205722im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Destroy all scripts on object. 3 Answers
How to destroy linked components when object is destroyed? 1 Answer
Component Disabling vs. Destroying 1 Answer
Call compoent by name 2 Answers
Component not destroyed 1 Answer