- Home /
Multple 2D hinge Joints
//1st joint
hingejoints[0]= Rope.AddComponent();
hingejoints[0].GetComponent().connectedBody=GameObject.Find("Rope_02").GetComponent();
hingejoints[0].GetComponent().anchor = new Vector2(-1.3f,0f);
hingejoints[0].GetComponent().connectedAnchor = new Vector2(1.1f,0f);
//2nd joint
hingejoints[1]= Rope.AddComponent();
hingejoints[1].GetComponent().connectedBody = Player.GetComponent();
hingejoints[1].GetComponent().anchor = new Vector2(.69f,0f);
hingejoints[1].GetComponent().connectedAnchor = new Vector2(0f,-0.63f);
Alright so I'm trying to make a reference to the 2nd HingeJoint attached to a game object. The problem is it keeps referencing the first one, not second. I've looked at GetComponents(). I've literally tried everything now, even the documented way. It detects I have two hinge joints, Changes the value of first one when it's supposed to set the 2nd one. I'm completely stuck.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612072217im_/https://answers.unity.com/themes/thub/images/avi.jpg)