I have a game where the player(a sideview ragdoll) hooks onto various bodies in the world using a rigid rope. The rope is quite literally just a RopeJoint with a texture slapped on top of it. In order to prevent runtime allocation as this game is targeting
xbox, joints are reused. There are two joints this system deals with: a RopeJoint for the rope, and a RevoluteJoint to connect the hands together. The process works as follows:
1) At some point the player fires the rope in the desired direction, hooking onto a body if possible. The RopeJoint has BodyA set to the players right hand and BodyB set to the hooked body, with the anchors set to their corresponding values. The RevoluteJoint
has BodyA set to the players left hand and BodyB set to the players right hand, with the anchors set to their corresponding values. Both joints are added to the world and ProcessChanges is called.
2) At some point the player releases the rope, unhooking from the body. Both joints are removed from the world and ProcessChanges is called.
This functions well for a while, until the game enters an infinite loop. Utilizing Break All I discovered there is an infinite loop in the JointEdge loop located within World.Solve. It appears that somehow the Next property is being set to the same joint
edge, thus causing it to repeat indefinitely.
Does the current version of Farseer support reusing joints? If so, what am I doing wrong? If not, is there an alternative that doesn't involve creating garbage?