yes, I am designing inside Rube, generate the JSON file in Rube,
load the JSON file into my App and then let the App save the changed world to JSON again.
And in the JSON saved by my App the error occurs.
Sorry if I was not explicit enough in my problem description.
My code does contain your snippet:
Code: Select all
motorDef.linearOffset = jsonToVec("anchorA", jointValue);//editor uses anchorA as the linear offset
m_localAnchorA and m_localAnchorB !?!?!
So I can not try your changes ..... .
This is my b2MotorJoint declaration:
Code: Select all
class b2MotorJoint : public b2Joint
{
public:
b2Vec2 GetAnchorA() const;
b2Vec2 GetAnchorB() const;
b2Vec2 GetReactionForce(float32 inv_dt) const;
float32 GetReactionTorque(float32 inv_dt) const;
/// Set/get the target linear offset, in frame A, in meters.
void SetLinearOffset(const b2Vec2& linearOffset);
const b2Vec2& GetLinearOffset() const;
/// Set/get the target angular offset, in radians.
void SetAngularOffset(float32 angularOffset);
float32 GetAngularOffset() const;
/// Set the maximum friction force in N.
void SetMaxForce(float32 force);
/// Get the maximum friction force in N.
float32 GetMaxForce() const;
/// Set the maximum friction torque in N*m.
void SetMaxTorque(float32 torque);
/// Get the maximum friction torque in N*m.
float32 GetMaxTorque() const;
/// Set the position correction factor in the range [0,1].
void SetCorrectionFactor(float32 factor);
/// Get the position correction factor in the range [0,1].
float32 GetCorrectionFactor() const;
/// Dump to b2Log
void Dump();
protected:
friend class b2Joint;
b2MotorJoint(const b2MotorJointDef* def);
void InitVelocityConstraints(const b2SolverData& data);
void SolveVelocityConstraints(const b2SolverData& data);
bool SolvePositionConstraints(const b2SolverData& data);
// Solver shared
b2Vec2 m_linearOffset;
float32 m_angularOffset;
b2Vec2 m_linearImpulse;
float32 m_angularImpulse;
float32 m_maxForce;
float32 m_maxTorque;
float32 m_correctionFactor;
// Solver temp
int32 m_indexA;
int32 m_indexB;
b2Vec2 m_rA;
b2Vec2 m_rB;
b2Vec2 m_localCenterA;
b2Vec2 m_localCenterB;
b2Vec2 m_linearError;
float32 m_angularError;
float32 m_invMassA;
float32 m_invMassB;
float32 m_invIA;
float32 m_invIB;
b2Mat22 m_linearMass;
float32 m_angularMass;
};
Did you do any changes to the Box2D code ?
Version 2.2.1 did not contain the motorJoint, so I assume you are using a later version ?
I am using version 2.3.1 from here:
http://box2d.org/2014/04/box2d-v2-3-1-released/
Now I am confused as well.
Best regards,
Thomas