From 31a85e81a26f7140444950037d28a79c7e765291 Mon Sep 17 00:00:00 2001 From: Bill Meltsner Date: Sat, 4 Feb 2012 19:53:29 -0500 Subject: [PATCH] Properly convert the anchor points for RopeJoints to local coordinates --- src/modules/physics/box2d/RopeJoint.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/physics/box2d/RopeJoint.cpp b/src/modules/physics/box2d/RopeJoint.cpp index 70fd57284..4daa7e026 100644 --- a/src/modules/physics/box2d/RopeJoint.cpp +++ b/src/modules/physics/box2d/RopeJoint.cpp @@ -37,8 +37,8 @@ namespace box2d b2RopeJointDef def; def.bodyA = body1->body; def.bodyB = body2->body; - def.localAnchorA = Physics::scaleDown(b2Vec2(x1,y1)); - def.localAnchorB = Physics::scaleDown(b2Vec2(x2,y2)); + body1->getLocalPoint(Physics::scaleDown(x1), Physics::scaleDown(y1), def.localAnchorA.x, def.localAnchorA.y); + body2->getLocalPoint(Physics::scaleDown(x2), Physics::scaleDown(y2), def.localAnchorB.x, def.localAnchorB.y); def.maxLength = Physics::scaleDown(maxLength); def.collideConnected = collideConnected; joint = (b2RopeJoint*)createJoint(&def);