Skip to content

Commit

Permalink
World dump now writes to a file instead of std out (#596)
Browse files Browse the repository at this point in the history
Dumps to box2d_dump.inl
  • Loading branch information
erincatto authored Apr 11, 2020
1 parent 913a40a commit e94472d
Show file tree
Hide file tree
Showing 18 changed files with 218 additions and 179 deletions.
2 changes: 1 addition & 1 deletion include/box2d/b2_body.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ class b2Body
b2World* GetWorld();
const b2World* GetWorld() const;

/// Dump this body to a log file
/// Dump this body to a file
void Dump();

private:
Expand Down
2 changes: 1 addition & 1 deletion include/box2d/b2_joint.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class b2Joint
bool GetCollideConnected() const;

/// Dump this joint to the log file.
virtual void Dump() { b2Log("// Dump is not supported for this joint type.\n"); }
virtual void Dump() { b2Dump("// Dump is not supported for this joint type.\n"); }

/// Shift the origin for any points stored in world coordinates.
virtual void ShiftOrigin(const b2Vec2& newOrigin) { B2_NOT_USED(newOrigin); }
Expand Down
5 changes: 5 additions & 0 deletions include/box2d/b2_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ void b2Free(void* mem);
/// Logging function.
void b2Log(const char* string, ...);

/// Dump to a file. Only one dump file allowed at a time.
void b2OpenDump(const char* fileName);
void b2Dump(const char* string, ...);
void b2CloseDump();

/// Version numbering scheme.
/// See http://en.wikipedia.org/wiki/Software_versioning
struct b2Version
Expand Down
29 changes: 29 additions & 0 deletions src/common/b2_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#define _CRT_SECURE_NO_WARNINGS

#include "box2d/b2_settings.h"
#include <stdio.h>
#include <stdarg.h>
Expand All @@ -46,3 +48,30 @@ void b2Log(const char* string, ...)
vprintf(string, args);
va_end(args);
}

FILE* b2_dumpFile = nullptr;

void b2OpenDump(const char* fileName)
{
b2Assert(b2_dumpFile == nullptr);
b2_dumpFile = fopen(fileName, "w");
}

void b2Dump(const char* string, ...)
{
if (b2_dumpFile == nullptr)
{
return;
}

va_list args;
va_start(args, string);
vfprintf(b2_dumpFile, string, args);
va_end(args);
}

void b2CloseDump()
{
fclose(b2_dumpFile);
b2_dumpFile = nullptr;
}
40 changes: 20 additions & 20 deletions src/dynamics/b2_body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,28 +531,28 @@ void b2Body::Dump()
{
int32 bodyIndex = m_islandIndex;

b2Log("{\n");
b2Log(" b2BodyDef bd;\n");
b2Log(" bd.type = b2BodyType(%d);\n", m_type);
b2Log(" bd.position.Set(%.15lef, %.15lef);\n", m_xf.p.x, m_xf.p.y);
b2Log(" bd.angle = %.15lef;\n", m_sweep.a);
b2Log(" bd.linearVelocity.Set(%.15lef, %.15lef);\n", m_linearVelocity.x, m_linearVelocity.y);
b2Log(" bd.angularVelocity = %.15lef;\n", m_angularVelocity);
b2Log(" bd.linearDamping = %.15lef;\n", m_linearDamping);
b2Log(" bd.angularDamping = %.15lef;\n", m_angularDamping);
b2Log(" bd.allowSleep = bool(%d);\n", m_flags & e_autoSleepFlag);
b2Log(" bd.awake = bool(%d);\n", m_flags & e_awakeFlag);
b2Log(" bd.fixedRotation = bool(%d);\n", m_flags & e_fixedRotationFlag);
b2Log(" bd.bullet = bool(%d);\n", m_flags & e_bulletFlag);
b2Log(" bd.enabled = bool(%d);\n", m_flags & e_enabledFlag);
b2Log(" bd.gravityScale = %.15lef;\n", m_gravityScale);
b2Log(" bodies[%d] = m_world->CreateBody(&bd);\n", m_islandIndex);
b2Log("\n");
b2Dump("{\n");
b2Dump(" b2BodyDef bd;\n");
b2Dump(" bd.type = b2BodyType(%d);\n", m_type);
b2Dump(" bd.position.Set(%.15lef, %.15lef);\n", m_xf.p.x, m_xf.p.y);
b2Dump(" bd.angle = %.15lef;\n", m_sweep.a);
b2Dump(" bd.linearVelocity.Set(%.15lef, %.15lef);\n", m_linearVelocity.x, m_linearVelocity.y);
b2Dump(" bd.angularVelocity = %.15lef;\n", m_angularVelocity);
b2Dump(" bd.linearDamping = %.15lef;\n", m_linearDamping);
b2Dump(" bd.angularDamping = %.15lef;\n", m_angularDamping);
b2Dump(" bd.allowSleep = bool(%d);\n", m_flags & e_autoSleepFlag);
b2Dump(" bd.awake = bool(%d);\n", m_flags & e_awakeFlag);
b2Dump(" bd.fixedRotation = bool(%d);\n", m_flags & e_fixedRotationFlag);
b2Dump(" bd.bullet = bool(%d);\n", m_flags & e_bulletFlag);
b2Dump(" bd.enabled = bool(%d);\n", m_flags & e_enabledFlag);
b2Dump(" bd.gravityScale = %.15lef;\n", m_gravityScale);
b2Dump(" bodies[%d] = m_world->CreateBody(&bd);\n", m_islandIndex);
b2Dump("\n");
for (b2Fixture* f = m_fixtureList; f; f = f->m_next)
{
b2Log(" {\n");
b2Dump(" {\n");
f->Dump(bodyIndex);
b2Log(" }\n");
b2Dump(" }\n");
}
b2Log("}\n");
b2Dump("}\n");
}
20 changes: 10 additions & 10 deletions src/dynamics/b2_distance_joint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,14 @@ void b2DistanceJoint::Dump()
int32 indexA = m_bodyA->m_islandIndex;
int32 indexB = m_bodyB->m_islandIndex;

b2Log(" b2DistanceJointDef jd;\n");
b2Log(" jd.bodyA = bodies[%d];\n", indexA);
b2Log(" jd.bodyB = bodies[%d];\n", indexB);
b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected);
b2Log(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y);
b2Log(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y);
b2Log(" jd.length = %.15lef;\n", m_length);
b2Log(" jd.frequencyHz = %.15lef;\n", m_frequencyHz);
b2Log(" jd.dampingRatio = %.15lef;\n", m_dampingRatio);
b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index);
b2Dump(" b2DistanceJointDef jd;\n");
b2Dump(" jd.bodyA = bodies[%d];\n", indexA);
b2Dump(" jd.bodyB = bodies[%d];\n", indexB);
b2Dump(" jd.collideConnected = bool(%d);\n", m_collideConnected);
b2Dump(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y);
b2Dump(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y);
b2Dump(" jd.length = %.15lef;\n", m_length);
b2Dump(" jd.frequencyHz = %.15lef;\n", m_frequencyHz);
b2Dump(" jd.dampingRatio = %.15lef;\n", m_dampingRatio);
b2Dump(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index);
}
70 changes: 35 additions & 35 deletions src/dynamics/b2_fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,76 +232,76 @@ void b2Fixture::SetSensor(bool sensor)

void b2Fixture::Dump(int32 bodyIndex)
{
b2Log(" b2FixtureDef fd;\n");
b2Log(" fd.friction = %.15lef;\n", m_friction);
b2Log(" fd.restitution = %.15lef;\n", m_restitution);
b2Log(" fd.density = %.15lef;\n", m_density);
b2Log(" fd.isSensor = bool(%d);\n", m_isSensor);
b2Log(" fd.filter.categoryBits = uint16(%d);\n", m_filter.categoryBits);
b2Log(" fd.filter.maskBits = uint16(%d);\n", m_filter.maskBits);
b2Log(" fd.filter.groupIndex = int16(%d);\n", m_filter.groupIndex);
b2Dump(" b2FixtureDef fd;\n");
b2Dump(" fd.friction = %.15lef;\n", m_friction);
b2Dump(" fd.restitution = %.15lef;\n", m_restitution);
b2Dump(" fd.density = %.15lef;\n", m_density);
b2Dump(" fd.isSensor = bool(%d);\n", m_isSensor);
b2Dump(" fd.filter.categoryBits = uint16(%d);\n", m_filter.categoryBits);
b2Dump(" fd.filter.maskBits = uint16(%d);\n", m_filter.maskBits);
b2Dump(" fd.filter.groupIndex = int16(%d);\n", m_filter.groupIndex);

switch (m_shape->m_type)
{
case b2Shape::e_circle:
{
b2CircleShape* s = (b2CircleShape*)m_shape;
b2Log(" b2CircleShape shape;\n");
b2Log(" shape.m_radius = %.15lef;\n", s->m_radius);
b2Log(" shape.m_p.Set(%.15lef, %.15lef);\n", s->m_p.x, s->m_p.y);
b2Dump(" b2CircleShape shape;\n");
b2Dump(" shape.m_radius = %.15lef;\n", s->m_radius);
b2Dump(" shape.m_p.Set(%.15lef, %.15lef);\n", s->m_p.x, s->m_p.y);
}
break;

case b2Shape::e_edge:
{
b2EdgeShape* s = (b2EdgeShape*)m_shape;
b2Log(" b2EdgeShape shape;\n");
b2Log(" shape.m_radius = %.15lef;\n", s->m_radius);
b2Log(" shape.m_vertex0.Set(%.15lef, %.15lef);\n", s->m_vertex0.x, s->m_vertex0.y);
b2Log(" shape.m_vertex1.Set(%.15lef, %.15lef);\n", s->m_vertex1.x, s->m_vertex1.y);
b2Log(" shape.m_vertex2.Set(%.15lef, %.15lef);\n", s->m_vertex2.x, s->m_vertex2.y);
b2Log(" shape.m_vertex3.Set(%.15lef, %.15lef);\n", s->m_vertex3.x, s->m_vertex3.y);
b2Log(" shape.m_hasVertex0 = bool(%d);\n", s->m_hasVertex0);
b2Log(" shape.m_hasVertex3 = bool(%d);\n", s->m_hasVertex3);
b2Dump(" b2EdgeShape shape;\n");
b2Dump(" shape.m_radius = %.15lef;\n", s->m_radius);
b2Dump(" shape.m_vertex0.Set(%.15lef, %.15lef);\n", s->m_vertex0.x, s->m_vertex0.y);
b2Dump(" shape.m_vertex1.Set(%.15lef, %.15lef);\n", s->m_vertex1.x, s->m_vertex1.y);
b2Dump(" shape.m_vertex2.Set(%.15lef, %.15lef);\n", s->m_vertex2.x, s->m_vertex2.y);
b2Dump(" shape.m_vertex3.Set(%.15lef, %.15lef);\n", s->m_vertex3.x, s->m_vertex3.y);
b2Dump(" shape.m_hasVertex0 = bool(%d);\n", s->m_hasVertex0);
b2Dump(" shape.m_hasVertex3 = bool(%d);\n", s->m_hasVertex3);
}
break;

case b2Shape::e_polygon:
{
b2PolygonShape* s = (b2PolygonShape*)m_shape;
b2Log(" b2PolygonShape shape;\n");
b2Log(" b2Vec2 vs[%d];\n", b2_maxPolygonVertices);
b2Dump(" b2PolygonShape shape;\n");
b2Dump(" b2Vec2 vs[%d];\n", b2_maxPolygonVertices);
for (int32 i = 0; i < s->m_count; ++i)
{
b2Log(" vs[%d].Set(%.15lef, %.15lef);\n", i, s->m_vertices[i].x, s->m_vertices[i].y);
b2Dump(" vs[%d].Set(%.15lef, %.15lef);\n", i, s->m_vertices[i].x, s->m_vertices[i].y);
}
b2Log(" shape.Set(vs, %d);\n", s->m_count);
b2Dump(" shape.Set(vs, %d);\n", s->m_count);
}
break;

case b2Shape::e_chain:
{
b2ChainShape* s = (b2ChainShape*)m_shape;
b2Log(" b2ChainShape shape;\n");
b2Log(" b2Vec2 vs[%d];\n", s->m_count);
b2Dump(" b2ChainShape shape;\n");
b2Dump(" b2Vec2 vs[%d];\n", s->m_count);
for (int32 i = 0; i < s->m_count; ++i)
{
b2Log(" vs[%d].Set(%.15lef, %.15lef);\n", i, s->m_vertices[i].x, s->m_vertices[i].y);
b2Dump(" vs[%d].Set(%.15lef, %.15lef);\n", i, s->m_vertices[i].x, s->m_vertices[i].y);
}
b2Log(" shape.CreateChain(vs, %d);\n", s->m_count);
b2Log(" shape.m_prevVertex.Set(%.15lef, %.15lef);\n", s->m_prevVertex.x, s->m_prevVertex.y);
b2Log(" shape.m_nextVertex.Set(%.15lef, %.15lef);\n", s->m_nextVertex.x, s->m_nextVertex.y);
b2Log(" shape.m_hasPrevVertex = bool(%d);\n", s->m_hasPrevVertex);
b2Log(" shape.m_hasNextVertex = bool(%d);\n", s->m_hasNextVertex);
b2Dump(" shape.CreateChain(vs, %d);\n", s->m_count);
b2Dump(" shape.m_prevVertex.Set(%.15lef, %.15lef);\n", s->m_prevVertex.x, s->m_prevVertex.y);
b2Dump(" shape.m_nextVertex.Set(%.15lef, %.15lef);\n", s->m_nextVertex.x, s->m_nextVertex.y);
b2Dump(" shape.m_hasPrevVertex = bool(%d);\n", s->m_hasPrevVertex);
b2Dump(" shape.m_hasNextVertex = bool(%d);\n", s->m_hasNextVertex);
}
break;

default:
return;
}

b2Log("\n");
b2Log(" fd.shape = &shape;\n");
b2Log("\n");
b2Log(" bodies[%d]->CreateFixture(&fd);\n", bodyIndex);
b2Dump("\n");
b2Dump(" fd.shape = &shape;\n");
b2Dump("\n");
b2Dump(" bodies[%d]->CreateFixture(&fd);\n", bodyIndex);
}
18 changes: 9 additions & 9 deletions src/dynamics/b2_friction_joint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,13 @@ void b2FrictionJoint::Dump()
int32 indexA = m_bodyA->m_islandIndex;
int32 indexB = m_bodyB->m_islandIndex;

b2Log(" b2FrictionJointDef jd;\n");
b2Log(" jd.bodyA = bodies[%d];\n", indexA);
b2Log(" jd.bodyB = bodies[%d];\n", indexB);
b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected);
b2Log(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y);
b2Log(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y);
b2Log(" jd.maxForce = %.15lef;\n", m_maxForce);
b2Log(" jd.maxTorque = %.15lef;\n", m_maxTorque);
b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index);
b2Dump(" b2FrictionJointDef jd;\n");
b2Dump(" jd.bodyA = bodies[%d];\n", indexA);
b2Dump(" jd.bodyB = bodies[%d];\n", indexB);
b2Dump(" jd.collideConnected = bool(%d);\n", m_collideConnected);
b2Dump(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y);
b2Dump(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y);
b2Dump(" jd.maxForce = %.15lef;\n", m_maxForce);
b2Dump(" jd.maxTorque = %.15lef;\n", m_maxTorque);
b2Dump(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index);
}
16 changes: 8 additions & 8 deletions src/dynamics/b2_gear_joint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,12 @@ void b2GearJoint::Dump()
int32 index1 = m_joint1->m_index;
int32 index2 = m_joint2->m_index;

b2Log(" b2GearJointDef jd;\n");
b2Log(" jd.bodyA = bodies[%d];\n", indexA);
b2Log(" jd.bodyB = bodies[%d];\n", indexB);
b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected);
b2Log(" jd.joint1 = joints[%d];\n", index1);
b2Log(" jd.joint2 = joints[%d];\n", index2);
b2Log(" jd.ratio = %.15lef;\n", m_ratio);
b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index);
b2Dump(" b2GearJointDef jd;\n");
b2Dump(" jd.bodyA = bodies[%d];\n", indexA);
b2Dump(" jd.bodyB = bodies[%d];\n", indexB);
b2Dump(" jd.collideConnected = bool(%d);\n", m_collideConnected);
b2Dump(" jd.joint1 = joints[%d];\n", index1);
b2Dump(" jd.joint2 = joints[%d];\n", index2);
b2Dump(" jd.ratio = %.15lef;\n", m_ratio);
b2Dump(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index);
}
20 changes: 10 additions & 10 deletions src/dynamics/b2_motor_joint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,14 @@ void b2MotorJoint::Dump()
int32 indexA = m_bodyA->m_islandIndex;
int32 indexB = m_bodyB->m_islandIndex;

b2Log(" b2MotorJointDef jd;\n");
b2Log(" jd.bodyA = bodies[%d];\n", indexA);
b2Log(" jd.bodyB = bodies[%d];\n", indexB);
b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected);
b2Log(" jd.linearOffset.Set(%.15lef, %.15lef);\n", m_linearOffset.x, m_linearOffset.y);
b2Log(" jd.angularOffset = %.15lef;\n", m_angularOffset);
b2Log(" jd.maxForce = %.15lef;\n", m_maxForce);
b2Log(" jd.maxTorque = %.15lef;\n", m_maxTorque);
b2Log(" jd.correctionFactor = %.15lef;\n", m_correctionFactor);
b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index);
b2Dump(" b2MotorJointDef jd;\n");
b2Dump(" jd.bodyA = bodies[%d];\n", indexA);
b2Dump(" jd.bodyB = bodies[%d];\n", indexB);
b2Dump(" jd.collideConnected = bool(%d);\n", m_collideConnected);
b2Dump(" jd.linearOffset.Set(%.15lef, %.15lef);\n", m_linearOffset.x, m_linearOffset.y);
b2Dump(" jd.angularOffset = %.15lef;\n", m_angularOffset);
b2Dump(" jd.maxForce = %.15lef;\n", m_maxForce);
b2Dump(" jd.maxTorque = %.15lef;\n", m_maxTorque);
b2Dump(" jd.correctionFactor = %.15lef;\n", m_correctionFactor);
b2Dump(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index);
}
30 changes: 15 additions & 15 deletions src/dynamics/b2_prismatic_joint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,21 +589,21 @@ void b2PrismaticJoint::Dump()
int32 indexA = m_bodyA->m_islandIndex;
int32 indexB = m_bodyB->m_islandIndex;

b2Log(" b2PrismaticJointDef jd;\n");
b2Log(" jd.bodyA = bodies[%d];\n", indexA);
b2Log(" jd.bodyB = bodies[%d];\n", indexB);
b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected);
b2Log(" jd.localAnchorA.Set(%.9g, %.9g);\n", m_localAnchorA.x, m_localAnchorA.y);
b2Log(" jd.localAnchorB.Set(%.9g, %.9g);\n", m_localAnchorB.x, m_localAnchorB.y);
b2Log(" jd.localAxisA.Set(%.9g, %.9g);\n", m_localXAxisA.x, m_localXAxisA.y);
b2Log(" jd.referenceAngle = %.9g;\n", m_referenceAngle);
b2Log(" jd.enableLimit = bool(%d);\n", m_enableLimit);
b2Log(" jd.lowerTranslation = %.9g;\n", m_lowerTranslation);
b2Log(" jd.upperTranslation = %.9g;\n", m_upperTranslation);
b2Log(" jd.enableMotor = bool(%d);\n", m_enableMotor);
b2Log(" jd.motorSpeed = %.9g;\n", m_motorSpeed);
b2Log(" jd.maxMotorForce = %.9g;\n", m_maxMotorForce);
b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index);
b2Dump(" b2PrismaticJointDef jd;\n");
b2Dump(" jd.bodyA = bodies[%d];\n", indexA);
b2Dump(" jd.bodyB = bodies[%d];\n", indexB);
b2Dump(" jd.collideConnected = bool(%d);\n", m_collideConnected);
b2Dump(" jd.localAnchorA.Set(%.9g, %.9g);\n", m_localAnchorA.x, m_localAnchorA.y);
b2Dump(" jd.localAnchorB.Set(%.9g, %.9g);\n", m_localAnchorB.x, m_localAnchorB.y);
b2Dump(" jd.localAxisA.Set(%.9g, %.9g);\n", m_localXAxisA.x, m_localXAxisA.y);
b2Dump(" jd.referenceAngle = %.9g;\n", m_referenceAngle);
b2Dump(" jd.enableLimit = bool(%d);\n", m_enableLimit);
b2Dump(" jd.lowerTranslation = %.9g;\n", m_lowerTranslation);
b2Dump(" jd.upperTranslation = %.9g;\n", m_upperTranslation);
b2Dump(" jd.enableMotor = bool(%d);\n", m_enableMotor);
b2Dump(" jd.motorSpeed = %.9g;\n", m_motorSpeed);
b2Dump(" jd.maxMotorForce = %.9g;\n", m_maxMotorForce);
b2Dump(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index);
}

///
Expand Down
24 changes: 12 additions & 12 deletions src/dynamics/b2_pulley_joint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,18 +331,18 @@ void b2PulleyJoint::Dump()
int32 indexA = m_bodyA->m_islandIndex;
int32 indexB = m_bodyB->m_islandIndex;

b2Log(" b2PulleyJointDef jd;\n");
b2Log(" jd.bodyA = bodies[%d];\n", indexA);
b2Log(" jd.bodyB = bodies[%d];\n", indexB);
b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected);
b2Log(" jd.groundAnchorA.Set(%.15lef, %.15lef);\n", m_groundAnchorA.x, m_groundAnchorA.y);
b2Log(" jd.groundAnchorB.Set(%.15lef, %.15lef);\n", m_groundAnchorB.x, m_groundAnchorB.y);
b2Log(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y);
b2Log(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y);
b2Log(" jd.lengthA = %.15lef;\n", m_lengthA);
b2Log(" jd.lengthB = %.15lef;\n", m_lengthB);
b2Log(" jd.ratio = %.15lef;\n", m_ratio);
b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index);
b2Dump(" b2PulleyJointDef jd;\n");
b2Dump(" jd.bodyA = bodies[%d];\n", indexA);
b2Dump(" jd.bodyB = bodies[%d];\n", indexB);
b2Dump(" jd.collideConnected = bool(%d);\n", m_collideConnected);
b2Dump(" jd.groundAnchorA.Set(%.15lef, %.15lef);\n", m_groundAnchorA.x, m_groundAnchorA.y);
b2Dump(" jd.groundAnchorB.Set(%.15lef, %.15lef);\n", m_groundAnchorB.x, m_groundAnchorB.y);
b2Dump(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y);
b2Dump(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y);
b2Dump(" jd.lengthA = %.15lef;\n", m_lengthA);
b2Dump(" jd.lengthB = %.15lef;\n", m_lengthB);
b2Dump(" jd.ratio = %.15lef;\n", m_ratio);
b2Dump(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index);
}

void b2PulleyJoint::ShiftOrigin(const b2Vec2& newOrigin)
Expand Down
Loading

0 comments on commit e94472d

Please sign in to comment.