- Home /
Question by
JBarrios · Feb 17, 2014 at 04:08 AM ·
hingejointfixedjoint
My Fixed Joint springs back to Zero.
Here's my code:
// Start
float xPosition = 10;
float yPosition = 30;
// While the whole length of rope
while(ropeCount > 0 )
{
GameObject newRope;
if(ropes.Count > 0)
{
// create rope
newRope = (GameObject)Instantiate(ropePrefab);
newRope.transform.position = new Vector2(xPosition, yPosition);
// attach rope
((HingeJoint)newRope.GetComponent<HingeJoint>()).connectedBody =
((GameObject)ropes[ropes.Count - 1]).rigidbody;
}
else
{
// create hook
newRope = (GameObject)Instantiate(ropeHookPrefab);
newRope.transform.position = new Vector2(xPosition, yPosition);
}
ropes.Add(newRope);
// move position
xPosition += xMovement;
yPosition += yMovement;
ropeCount--;
}
ropePrefab is a hinge joint object. ropeHookPrefab is a fixed joint object.
When I run this function all the objects line up exactly like they are supposed to. However, within two seconds the fixed joint pops back to position (0,0,0). No where in my code do I say move the fixed joint. Any idea what's going on?
Comment
Your answer
Follow this Question
Related Questions
make a lever with physic ? hinge or spring joint ? 0 Answers
Connectors with unintended effect of spring before breaking up 0 Answers
Hinges required for see-saw or catapult effect. 1 Answer
[VR] Door with Hinge Joint opens when hand moves in the wrong axis 2 Answers
How to use character controller to push down hinge joint properly 1 Answer