I do have a problem with saving my world into a JSON file in C++.
Basically, the problem is that in the saved JSON the anchors of a motor joint are not in the location as set in RUBE, but on the local center of the attached bodies.
Have a look at these screenshots:
1. Design in Rube: 2. Saved JSON file: These are the differentes in the JSON file:
1. Design in Rube:
Code: Select all
{
"anchorA" :
{
"x" : 0.01180840004235506,
"y" : -2.480469942092896
},
"anchorB" : 0,
"bodyA" : 3,
"bodyB" : 1,
"correctionFactor" : 0.5,
"maxForce" : 10,
"maxTorque" : 10,
"name" : "MotorJoint",
"refAngle" : 0,
"type" : "motor"
},
Code: Select all
{
"anchorA" : 0,
"anchorB" : 0,
"bodyA" : 0,
"bodyB" : 2,
"maxForce" : "41200000",
"maxTorque" : "41200000",
"name" : "MotorJoint",
"refAngle" : 0,
"type" : "motor"
},
I can see why the anchors are set like they are, because the local center of the attached bodies is taken.
Why the maxForce and maxTorque do have these values, I do not know.
I have attached the Rube file for you to test.
The design is quite Esels and just for trying the Motor joint.
Could you advise how to get around the problem of the wrong motorJoint ?
Thanks for your help,
Thomas