Jun 28, 2010 at 4:12 PM
Edited Jun 28, 2010 at 8:42 PM
I'll check what you said Jerky but wouldn't it still crash if I switched WeldJoint to RevoluteJoint? Because when I do that, the game runs fine.
foreach (Body body in addiBodies)
//Create and add weldJoint to world
RevoluteJoint tempJoint = new RevoluteJoint(mainBody, body, Vector2.Zero);
I still checked it just to be sure by looking at the number of joints in the World list on the first update and then how many there are 20 updates later (just before it freezes). There are the exact same amount of joints in the list. I also looked at the
comparison when switching between RevoluteJoint and WeldJoint. I didn't see anything noticeable. They both have about the same update times.
I currently have not implemented any try, catch statements with my code. Maybe not the smartest thing to do but I was planning on looking into all of that once I'm near the end of my game. I have been running in Release mode though and switched over to Debug
mode but it's still freezing and no exceptions are being called or anything.
There are about 1700 contacts when the game just completely lags. I looked into where these contacts are occurring and it's always with some sort of ground (static) body. I know this because anything in CollisionCategory Cat10 is a ground body.
Even more is that I looked into the other contact collision and it always has a position of Vector2(NaN, NaN). It is not the same ground fixture everytime either but it is always a ground fixture from what I've seen. There are way too many contacts to look
through each one but these are my findings after looking through about 12-15 contacts. Let me add that the first 50 or so contacts look pretty normal. Everything after that has positions of NaN.
For now I'm just changing them to RevoluteJoints and setting their rotation as fixed. Quick fix. But if anyone finds out why this doesn't work or when it finally does work, please let me know.