RUBE save scene after destroying and rebuilding joint
Posted: Tue Oct 13, 2015 2:57 pm
				
				Hi Chris,
I am using the b2dJson::writeToFile of b2dJson to write out the current world state.
That has worked quite well till now, but now I do get problems after I have destroyed and then rebuild several joints with custom properties.
Basically, I do get the custom properties, as well as the name of the destroyed joint attached to another joint (which I did destroy and rebuild as well). In my case, the mixup seems to happen even across joint type boundaries, so a former weld joint is now a prismatic joint. (Both joint types were part of the destroy and rebuild cycle.)
Example of the mixup:
Original:
After destroy and rebuild cycle involving several joints:
Therefore my questions are:
1) Is the b2dJson::writeToFile functionality at all useful to save a copy of the current b2world ?
2) Is destroying and rebuilding of joints allowed in conjunction with b2dJson::writeToFile ?
3) Is there some housekeeping inside of b2dJson to be done by me to enable the software to keep track of the sutom properties and the joint name after destroying and rebuilding ?
If the answer to point 1) aready is negative, do you have a suggestion on how to save a state of the current b2world with all the custom properties ?
Sorry for the long mail and thanks for your help,
Thomas
			I am using the b2dJson::writeToFile of b2dJson to write out the current world state.
That has worked quite well till now, but now I do get problems after I have destroyed and then rebuild several joints with custom properties.
Basically, I do get the custom properties, as well as the name of the destroyed joint attached to another joint (which I did destroy and rebuild as well). In my case, the mixup seems to happen even across joint type boundaries, so a former weld joint is now a prismatic joint. (Both joint types were part of the destroy and rebuild cycle.)
Example of the mixup:
Original:
Code: Select all
"joint" : 
[
	{
		"anchorA" : 
		{
			"x" : 2.384185791015625e-07,
			"y" : -5.960464477539062e-07
		},
		"anchorB" : 
		{
			"x" : 0.2602210044860840,
			"y" : -0.01068103313446045
		},
		"bodyA" : 9,
		"bodyB" : 28,
		"customProperties" : 
		[
			
			{
				"int" : 16,
				"name" : "custJointNum"
			},
			
			{
				"name" : "constraints",
				"string" : "((E;T;11)|(L;LL;0)|(L;UL;40)|(FR;J;16)|(ME;J;15)|(FR;J;25)|(M;J;80)|(M;J;81)|(M;B;80)|(ML;J;25)|(ST;B;70)|(ST;B;23))"
			},
			
			{
				"name" : "custConnections",
				"string" : "(Connection_1;1;0.032;192.192.192;10;2;1;11;15)"
			}
		],
		"dampingRatio" : 1,
		"frequency" : 0,
		"name" : "MeasurePoint_1",
		"refAngle" : 0,
		"type" : "weld"
	},
Code: Select all
"joint" : 
[
	{
	   "anchorA" : 
	   {
	      "x" : "3E996200",
	      "y" : "BDFDC780"
	   },
	   "anchorB" : 
	   {
	      "x" : "BBA41B04",
	      "y" : "38B82480"
	   },
	   "bodyA" : 3,
	   "bodyB" : 20,
	   "customProperties" : 
	   [
	      
	      {
	         "int" : 16,
	         "name" : "custJointNum"
	      },
	      
	      {
	         "name" : "constraints",
	         "string" : "((E;T;11)|(L;LL;0)|(L;UL;40)|(FR;J;16)|(ME;J;15)|(FR;J;25)|(M;J;80)|(M;J;81)|(M;B;80)|(ML;J;25)|(ST;B;70)|(ST;B;23))"
	      },
	      
	      {
	         "name" : "custConnections",
	         "string" : "(Connection_1;1;0.032;192.192.192;10;2;1;11;15)"
	      }
	   ],
	   "enableLimit" : true,
	   "enableMotor" : false,
	   "localAxisA" : 
	   {
	      "x" : "3F64FA62",
	      "y" : "3EE4F45E"
	   },
	   "lowerLimit" : "3C23D70A",
	   "maxMotorForce" : 0,
	   "motorSpeed" : 0,
	   "name" : "MeasurePoint_1",
	   "refAngle" : "3FF38222",
	   "type" : "prismatic",
	   "upperLimit" : "3D23D564"
	},
Therefore my questions are:
1) Is the b2dJson::writeToFile functionality at all useful to save a copy of the current b2world ?
2) Is destroying and rebuilding of joints allowed in conjunction with b2dJson::writeToFile ?
3) Is there some housekeeping inside of b2dJson to be done by me to enable the software to keep track of the sutom properties and the joint name after destroying and rebuilding ?
If the answer to point 1) aready is negative, do you have a suggestion on how to save a state of the current b2world with all the custom properties ?
Sorry for the long mail and thanks for your help,
Thomas