Browse Source

exposed collideConnected flag

--HG--
branch : box2d-update
Bill Meltsner 14 years ago
parent
commit
e5fa4c87c6

+ 2 - 1
src/modules/physics/box2d/DistanceJoint.cpp

@@ -30,11 +30,12 @@ namespace physics
 {
 namespace box2d
 {
-	DistanceJoint::DistanceJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2)
+	DistanceJoint::DistanceJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2, bool collideConnected)
 		: Joint(body1, body2), joint(NULL)
 	{
 		b2DistanceJointDef def;
 		def.Initialize(body1->body, body2->body, world->scaleDown(b2Vec2(x1,y1)), world->scaleDown(b2Vec2(x2,y2)));
+		def.collideConnected = collideConnected;
 		joint = (b2DistanceJoint*)createJoint(&def);
 	}
 

+ 1 - 1
src/modules/physics/box2d/DistanceJoint.h

@@ -44,7 +44,7 @@ namespace box2d
 		/**
 		* Creates a DistanceJoint connecting body1 to body2. 
 		**/
-		DistanceJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2);
+		DistanceJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2, bool collideConnected);
 		
 		virtual ~DistanceJoint();
 

+ 2 - 1
src/modules/physics/box2d/FrictionJoint.cpp

@@ -32,11 +32,12 @@ namespace physics
 {
 namespace box2d
 {
-	FrictionJoint::FrictionJoint(Body * body1, Body * body2, float x, float y)
+	FrictionJoint::FrictionJoint(Body * body1, Body * body2, float x, float y, bool collideConnected)
 		: Joint(body1, body2), joint(NULL)
 	{	
 		b2FrictionJointDef def;
 		def.Initialize(body1->body, body2->body, world->scaleDown(b2Vec2(x,y)));
+		def.collideConnected = collideConnected;
 		joint = (b2FrictionJoint*)createJoint(&def);
 	}
 

+ 1 - 1
src/modules/physics/box2d/FrictionJoint.h

@@ -45,7 +45,7 @@ namespace box2d
 		/**
 		* Creates a new FrictionJoint connecting body1 and body2.
 		**/
-		FrictionJoint(Body * body1, Body * body2, float x, float y);
+		FrictionJoint(Body * body1, Body * body2, float x, float y, bool collideConnected);
 		
 		virtual ~FrictionJoint();
 

+ 2 - 1
src/modules/physics/box2d/GearJoint.cpp

@@ -30,7 +30,7 @@ namespace physics
 {
 namespace box2d
 {
-	GearJoint::GearJoint(Joint * joint1, Joint * joint2, float ratio)
+	GearJoint::GearJoint(Joint * joint1, Joint * joint2, float ratio, bool collideConnected)
 		: Joint(joint1->body2, joint2->body2), joint(NULL)
 	{
 		b2GearJointDef def;
@@ -39,6 +39,7 @@ namespace box2d
 		def.bodyA = joint1->body2->body;
 		def.bodyB = joint2->body2->body;
 		def.ratio = ratio;
+		def.collideConnected = collideConnected;
 		
 		joint = (b2GearJoint*)createJoint(&def);
 	}

+ 1 - 1
src/modules/physics/box2d/GearJoint.h

@@ -52,7 +52,7 @@ namespace box2d
 		/**
 		* Creates a GearJoint connecting joint1 to joint2. 
 		**/
-		GearJoint(Joint * joint1, Joint * joint2, float ratio);
+		GearJoint(Joint * joint1, Joint * joint2, float ratio, bool collideConnected);
 		
 		virtual ~GearJoint();
 		

+ 18 - 18
src/modules/physics/box2d/Physics.cpp

@@ -144,9 +144,9 @@ namespace box2d
 		return 1;
 	}
 
-	DistanceJoint * Physics::newDistanceJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2)
+	DistanceJoint * Physics::newDistanceJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2, bool collideConnected)
 	{
-		return new DistanceJoint(body1, body2, x1, y1, x2, y2);
+		return new DistanceJoint(body1, body2, x1, y1, x2, y2, collideConnected);
 	}
 
 	MouseJoint * Physics::newMouseJoint(Body * body, float x, float y)
@@ -154,44 +154,44 @@ namespace box2d
 		return new MouseJoint(body, x, y);
 	}
 
-	RevoluteJoint * Physics::newRevoluteJoint(Body * body1, Body * body2, float x, float y)
+	RevoluteJoint * Physics::newRevoluteJoint(Body * body1, Body * body2, float x, float y, bool collideConnected)
 	{
-		return new RevoluteJoint(body1, body2, x, y);
+		return new RevoluteJoint(body1, body2, x, y, collideConnected);
 	}
 
-	PrismaticJoint * Physics::newPrismaticJoint(Body * body1, Body * body2, float x, float y, float ax, float ay)
+	PrismaticJoint * Physics::newPrismaticJoint(Body * body1, Body * body2, float x, float y, float ax, float ay, bool collideConnected)
 	{
-		return new PrismaticJoint(body1, body2, x, y, ax, ay);
+		return new PrismaticJoint(body1, body2, x, y, ax, ay, collideConnected);
 	}
 
-	PulleyJoint * Physics::newPulleyJoint(Body * body1, Body * body2, b2Vec2 groundAnchor1, b2Vec2 groundAnchor2, b2Vec2 anchor1, b2Vec2 anchor2, float ratio)
+	PulleyJoint * Physics::newPulleyJoint(Body * body1, Body * body2, b2Vec2 groundAnchor1, b2Vec2 groundAnchor2, b2Vec2 anchor1, b2Vec2 anchor2, float ratio, bool collideConnected)
 	{
-		return new PulleyJoint(body1, body2, groundAnchor1, groundAnchor2, anchor1, anchor2, ratio);
+		return new PulleyJoint(body1, body2, groundAnchor1, groundAnchor2, anchor1, anchor2, ratio, collideConnected);
 	}
 
-	GearJoint * Physics::newGearJoint(Joint * joint1, Joint * joint2, float ratio)
+	GearJoint * Physics::newGearJoint(Joint * joint1, Joint * joint2, float ratio, bool collideConnected)
 	{
-		return new GearJoint(joint1, joint2, ratio);
+		return new GearJoint(joint1, joint2, ratio, collideConnected);
 	}
 	
-	FrictionJoint * Physics::newFrictionJoint(Body * body1, Body * body2, float x, float y)
+	FrictionJoint * Physics::newFrictionJoint(Body * body1, Body * body2, float x, float y, bool collideConnected)
 	{
-		return new FrictionJoint(body1, body2, x, y);
+		return new FrictionJoint(body1, body2, x, y, collideConnected);
 	}
 	
-	WeldJoint * Physics::newWeldJoint(Body * body1, Body * body2, float x, float y)
+	WeldJoint * Physics::newWeldJoint(Body * body1, Body * body2, float x, float y, bool collideConnected)
 	{
-		return new WeldJoint(body1, body2, x, y);
+		return new WeldJoint(body1, body2, x, y, collideConnected);
 	}
 	
-	WheelJoint * Physics::newWheelJoint(Body * body1, Body * body2, float x, float y, float ax, float ay)
+	WheelJoint * Physics::newWheelJoint(Body * body1, Body * body2, float x, float y, float ax, float ay, bool collideConnected)
 	{
-		return new WheelJoint(body1, body2, x, y, ax, ay);
+		return new WheelJoint(body1, body2, x, y, ax, ay, collideConnected);
 	}
 	
-	RopeJoint * Physics::newRopeJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2, float maxLength)
+	RopeJoint * Physics::newRopeJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2, float maxLength, bool collideConnected)
 	{
-		return new RopeJoint(body1, body2, x1, y1, x2, y2, maxLength);
+		return new RopeJoint(body1, body2, x1, y1, x2, y2, maxLength, collideConnected);
 	}
 
 } // box2d

+ 9 - 9
src/modules/physics/box2d/Physics.h

@@ -158,7 +158,7 @@ namespace box2d
 		* @param x2 Anchor2 along the x-axis. (World coordinates)
 		* @param y2 Anchor2 along the y-axis. (World coordinates)
 		**/
-		DistanceJoint * newDistanceJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2);
+		DistanceJoint * newDistanceJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2, bool collideConnected);
 
 		/**
 		* Creates a new MouseJoint connecting the body with an arbitrary point.
@@ -172,7 +172,7 @@ namespace box2d
 		* @param x Anchor along the x-axis. (World coordinates)
 		* @param y Anchor along the y-axis. (World coordinates)
 		**/
-		RevoluteJoint * newRevoluteJoint(Body * body1, Body * body2, float x, float y);
+		RevoluteJoint * newRevoluteJoint(Body * body1, Body * body2, float x, float y, bool collideConnected);
 
 		/**
 		* Creates a new PrismaticJoint connecting body1 with body2.
@@ -181,7 +181,7 @@ namespace box2d
 		* @param ax The x-component of the world-axis.
 		* @param ay The y-component of the world-axis.
 		**/
-		PrismaticJoint * newPrismaticJoint(Body * body1, Body * body2, float x, float y, float ax, float ay);
+		PrismaticJoint * newPrismaticJoint(Body * body1, Body * body2, float x, float y, float ax, float ay, bool collideConnected);
 
 		/**
 		* Creates a new PulleyJoint connecting body1 with body2.
@@ -191,7 +191,7 @@ namespace box2d
 		* @param anchor2 World anchor on body2.
 		* @param ratio The pulley ratio.
 		**/
-		PulleyJoint * newPulleyJoint(Body * body1, Body * body2, b2Vec2 groundAnchor1, b2Vec2 groundAnchor2, b2Vec2 anchor1, b2Vec2 anchor2, float ratio);
+		PulleyJoint * newPulleyJoint(Body * body1, Body * body2, b2Vec2 groundAnchor1, b2Vec2 groundAnchor2, b2Vec2 anchor1, b2Vec2 anchor2, float ratio, bool collideConnected);
 
 		/**
 		* Creates a new GearJoint connecting joint1 with joint2.
@@ -199,21 +199,21 @@ namespace box2d
 		* @param joint2 The second joint.
 		* @param ratio The gear ratio.
 		**/
-		GearJoint * newGearJoint(Joint * joint1, Joint * joint2, float ratio);
+		GearJoint * newGearJoint(Joint * joint1, Joint * joint2, float ratio, bool collideConnected);
 
 		/**
 		* Creates a new FrictionJoint connecting body1 with body2.
 		* @param x Anchor along the x-axis. (World coordinates)
 		* @param y Anchor along the y-axis. (World coordinates)
 		**/
-		FrictionJoint * newFrictionJoint(Body * body1, Body * body2, float x, float y);
+		FrictionJoint * newFrictionJoint(Body * body1, Body * body2, float x, float y, bool collideConnected);
 		
 		/**
 		* Creates a new WeldJoint connecting body1 with body2.
 		* @param x Anchor along the x-axis. (World coordinates)
 		* @param y Anchor along the y-axis. (World coordinates)
 		**/
-		WeldJoint * newWeldJoint(Body * body1, Body * body2, float x, float y);
+		WeldJoint * newWeldJoint(Body * body1, Body * body2, float x, float y, bool collideConnected);
 		
 		/**
 		* Creates a new WheelJoint connecting body1 with body2.
@@ -222,7 +222,7 @@ namespace box2d
 		* @param ax The x-component of the world-axis.
 		* @param ay The y-component of the world-axis.
 		**/
-		WheelJoint * newWheelJoint(Body * body1, Body * body2, float x, float y, float ax, float ay);
+		WheelJoint * newWheelJoint(Body * body1, Body * body2, float x, float y, float ax, float ay, bool collideConnected);
 		
 		/**
 		* Creates a new RopeJoint connecting body1 with body2.
@@ -232,7 +232,7 @@ namespace box2d
 		* @param y2 Anchor2 along the y-axis. (Local coordinates)
 		* @param maxLength The maximum distance for the bodies.
 		**/
-		RopeJoint * newRopeJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2, float maxLength);
+		RopeJoint * newRopeJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2, float maxLength, bool collideConnected);
 
 
 	}; // Physics

+ 2 - 1
src/modules/physics/box2d/PrismaticJoint.cpp

@@ -30,7 +30,7 @@ namespace physics
 {
 namespace box2d
 {
-	PrismaticJoint::PrismaticJoint(Body * body1, Body * body2, float x, float y, float ax, float ay)
+	PrismaticJoint::PrismaticJoint(Body * body1, Body * body2, float x, float y, float ax, float ay, bool collideConnected)
 		: Joint(body1, body2), joint(NULL)
 	{
 		b2PrismaticJointDef def;
@@ -39,6 +39,7 @@ namespace box2d
 		def.lowerTranslation = 0.0f;
 		def.upperTranslation = 100.0f;
 		def.enableLimit = true;
+		def.collideConnected = collideConnected;
 		joint = (b2PrismaticJoint*)createJoint(&def);
 	}
 

+ 1 - 1
src/modules/physics/box2d/PrismaticJoint.h

@@ -46,7 +46,7 @@ namespace box2d
 		/**
 		* Creates a new PrismaticJoint connecting body1 and body2.
 		**/
-		PrismaticJoint(Body * body1, Body * body2, float x, float y, float ax, float ay);
+		PrismaticJoint(Body * body1, Body * body2, float x, float y, float ax, float ay, bool collideConnected);
 
 		virtual ~PrismaticJoint();
 

+ 2 - 1
src/modules/physics/box2d/PulleyJoint.cpp

@@ -30,12 +30,13 @@ namespace physics
 {
 namespace box2d
 {
-	PulleyJoint::PulleyJoint(Body * body1, Body * body2, b2Vec2 groundAnchor1, b2Vec2 groundAnchor2, b2Vec2 anchor1, b2Vec2 anchor2, float ratio)
+	PulleyJoint::PulleyJoint(Body * body1, Body * body2, b2Vec2 groundAnchor1, b2Vec2 groundAnchor2, b2Vec2 anchor1, b2Vec2 anchor2, float ratio, bool collideConnected)
 		: Joint(body1, body2), joint(NULL)
 	{
 		b2PulleyJointDef def;
 		def.Initialize(body1->body, body2->body, world->scaleDown(groundAnchor1), world->scaleDown(groundAnchor2), \
 			 world->scaleDown(anchor1), world->scaleDown(anchor2), ratio);
+		def.collideConnected = collideConnected;
 		
 		joint = (b2PulleyJoint*)createJoint(&def);
 	}

+ 1 - 1
src/modules/physics/box2d/PulleyJoint.h

@@ -46,7 +46,7 @@ namespace box2d
 		/**
 		* Creates a PulleyJoint connecting body1 to body2. 
 		**/
-		PulleyJoint(Body * body1, Body * body2, b2Vec2 groundAnchor1, b2Vec2 groundAnchor2, b2Vec2 anchor1, b2Vec2 anchor2, float ratio);
+		PulleyJoint(Body * body1, Body * body2, b2Vec2 groundAnchor1, b2Vec2 groundAnchor2, b2Vec2 anchor1, b2Vec2 anchor2, float ratio, bool collideConnected);
 		
 		virtual ~PulleyJoint();
 		

+ 2 - 1
src/modules/physics/box2d/RevoluteJoint.cpp

@@ -32,11 +32,12 @@ namespace physics
 {
 namespace box2d
 {
-	RevoluteJoint::RevoluteJoint(Body * body1, Body * body2, float x, float y)
+	RevoluteJoint::RevoluteJoint(Body * body1, Body * body2, float x, float y, bool collideConnected)
 		: Joint(body1, body2), joint(NULL)
 	{	
 		b2RevoluteJointDef def;
 		def.Initialize(body1->body, body2->body, world->scaleDown(b2Vec2(x,y)));
+		def.collideConnected = collideConnected;
 		joint = (b2RevoluteJoint*)createJoint(&def);
 	}
 

+ 1 - 1
src/modules/physics/box2d/RevoluteJoint.h

@@ -46,7 +46,7 @@ namespace box2d
 		/**
 		* Creates a new RevoluteJoint connecting body1 and body2.
 		**/
-		RevoluteJoint(Body * body1, Body * body2, float x, float y);
+		RevoluteJoint(Body * body1, Body * body2, float x, float y, bool collideConnected);
 		
 		virtual ~RevoluteJoint();
 

+ 2 - 1
src/modules/physics/box2d/RopeJoint.cpp

@@ -30,7 +30,7 @@ namespace physics
 {
 namespace box2d
 {
-	RopeJoint::RopeJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2, float maxLength)
+	RopeJoint::RopeJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2, float maxLength, bool collideConnected)
 		: Joint(body1, body2), joint(NULL)
 	{
 		b2RopeJointDef def;
@@ -39,6 +39,7 @@ namespace box2d
 		def.localAnchorA = world->scaleDown(b2Vec2(x1,y1));
 		def.localAnchorB = world->scaleDown(b2Vec2(x2,y2));
 		def.maxLength = world->scaleDown(maxLength);
+		def.collideConnected = collideConnected;
 		joint = (b2RopeJoint*)createJoint(&def);
 	}
 

+ 1 - 1
src/modules/physics/box2d/RopeJoint.h

@@ -44,7 +44,7 @@ namespace box2d
 		/**
 		* Creates a RopeJoint connecting body1 to body2. 
 		**/
-		RopeJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2, float maxLength);
+		RopeJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2, float maxLength, bool collideConnected);
 		
 		virtual ~RopeJoint();
 		

+ 2 - 1
src/modules/physics/box2d/WeldJoint.cpp

@@ -32,11 +32,12 @@ namespace physics
 {
 namespace box2d
 {
-	WeldJoint::WeldJoint(Body * body1, Body * body2, float x, float y)
+	WeldJoint::WeldJoint(Body * body1, Body * body2, float x, float y, bool collideConnected)
 		: Joint(body1, body2), joint(NULL)
 	{	
 		b2WeldJointDef def;
 		def.Initialize(body1->body, body2->body, world->scaleDown(b2Vec2(x,y)));
+		def.collideConnected = collideConnected;
 		joint = (b2WeldJoint*)createJoint(&def);
 	}
 

+ 1 - 1
src/modules/physics/box2d/WeldJoint.h

@@ -45,7 +45,7 @@ namespace box2d
 		/**
 		* Creates a new WeldJoint connecting body1 and body2.
 		**/
-		WeldJoint(Body * body1, Body * body2, float x, float y);
+		WeldJoint(Body * body1, Body * body2, float x, float y, bool collideConnected);
 		
 		virtual ~WeldJoint();
 

+ 2 - 1
src/modules/physics/box2d/WheelJoint.cpp

@@ -30,12 +30,13 @@ namespace physics
 {
 namespace box2d
 {
-	WheelJoint::WheelJoint(Body * body1, Body * body2, float x, float y, float ax, float ay)
+	WheelJoint::WheelJoint(Body * body1, Body * body2, float x, float y, float ax, float ay, bool collideConnected)
 		: Joint(body1, body2), joint(NULL)
 	{
 		b2WheelJointDef def;
 		
 		def.Initialize(body1->body, body2->body, world->scaleDown(b2Vec2(x,y)), b2Vec2(ax,ay));
+		def.collideConnected = collideConnected;
 		joint = (b2WheelJoint*)createJoint(&def);
 	}
 

+ 1 - 1
src/modules/physics/box2d/WheelJoint.h

@@ -47,7 +47,7 @@ namespace box2d
 		/**
 		* Creates a new WheelJoint connecting body1 and body2.
 		**/
-		WheelJoint(Body * body1, Body * body2, float x, float y, float ax, float ay);
+		WheelJoint(Body * body1, Body * body2, float x, float y, float ax, float ay, bool collideConnected);
 
 		virtual ~WheelJoint();
 

+ 18 - 9
src/modules/physics/box2d/wrap_Physics.cpp

@@ -136,7 +136,8 @@ namespace box2d
 		float y1 = (float)luaL_checknumber(L, 4);
 		float x2 = (float)luaL_checknumber(L, 5);
 		float y2 = (float)luaL_checknumber(L, 6);
-		DistanceJoint * j = instance->newDistanceJoint(body1, body2, x1, y1, x2, y2);
+		bool collideConnected = luax_optboolean(L, 7, false);
+		DistanceJoint * j = instance->newDistanceJoint(body1, body2, x1, y1, x2, y2, collideConnected);
 		luax_newtype(L, "DistanceJoint", PHYSICS_DISTANCE_JOINT_T, (void*)j);
 		return 1;
 	}
@@ -157,7 +158,8 @@ namespace box2d
 		Body * body2 = luax_checktype<Body>(L, 2, "Body", PHYSICS_BODY_T);
 		float x = (float)luaL_checknumber(L, 3);
 		float y = (float)luaL_checknumber(L, 4);
-		RevoluteJoint * j = instance->newRevoluteJoint(body1, body2, x, y);
+		bool collideConnected = luax_optboolean(L, 5, false);
+		RevoluteJoint * j = instance->newRevoluteJoint(body1, body2, x, y, collideConnected);
 		luax_newtype(L, "RevoluteJoint", PHYSICS_REVOLUTE_JOINT_T, (void*)j);
 		return 1;
 	}
@@ -170,7 +172,8 @@ namespace box2d
 		float y = (float)luaL_checknumber(L, 4);
 		float ax = (float)luaL_checknumber(L, 5);
 		float ay = (float)luaL_checknumber(L, 6);
-		PrismaticJoint * j = instance->newPrismaticJoint(body1, body2, x, y, ax, ay);
+		bool collideConnected = luax_optboolean(L, 7, false);
+		PrismaticJoint * j = instance->newPrismaticJoint(body1, body2, x, y, ax, ay, collideConnected);
 		luax_newtype(L, "PrismaticJoint", PHYSICS_PRISMATIC_JOINT_T, (void*)j);
 		return 1;
 	}
@@ -188,8 +191,9 @@ namespace box2d
 		float x2 = (float)luaL_checknumber(L, 9);
 		float y2 = (float)luaL_checknumber(L, 10);
 		float ratio = (float)luaL_optnumber(L, 11, 1.0);
+		bool collideConnected = luax_optboolean(L, 12, true); // PulleyJoints default to colliding connected bodies, see b2PulleyJoint.h
 
-		PulleyJoint * j = instance->newPulleyJoint(body1, body2, b2Vec2(gx1,gy1), b2Vec2(gx2,gy2), b2Vec2(x1,y1), b2Vec2(x2,y2), ratio);
+		PulleyJoint * j = instance->newPulleyJoint(body1, body2, b2Vec2(gx1,gy1), b2Vec2(gx2,gy2), b2Vec2(x1,y1), b2Vec2(x2,y2), ratio, collideConnected);
 		luax_newtype(L, "PulleyJoint", PHYSICS_PULLEY_JOINT_T, (void*)j);
 		return 1;
 	}
@@ -199,8 +203,9 @@ namespace box2d
 		Joint * joint1 = luax_checktype<Joint>(L, 1, "Joint", PHYSICS_JOINT_T);
 		Joint * joint2 = luax_checktype<Joint>(L, 2, "Joint", PHYSICS_JOINT_T);
 		float ratio = (float)luaL_optnumber(L, 3, 1.0);
+		bool collideConnected = luax_optboolean(L, 4, false);
 
-		GearJoint * j = instance->newGearJoint(joint1, joint2, ratio);
+		GearJoint * j = instance->newGearJoint(joint1, joint2, ratio, collideConnected);
 		luax_newtype(L, "GearJoint", PHYSICS_GEAR_JOINT_T, (void*)j);
 		return 1;
 	}
@@ -211,7 +216,8 @@ namespace box2d
 		Body * body2 = luax_checktype<Body>(L, 2, "Body", PHYSICS_BODY_T);
 		float x = (float)luaL_checknumber(L, 3);
 		float y = (float)luaL_checknumber(L, 4);
-		FrictionJoint * j = instance->newFrictionJoint(body1, body2, x, y);
+		bool collideConnected = luax_optboolean(L, 5, false);
+		FrictionJoint * j = instance->newFrictionJoint(body1, body2, x, y, collideConnected);
 		luax_newtype(L, "FrictionJoint", PHYSICS_FRICTION_JOINT_T, (void*)j);
 		return 1;
 	}
@@ -222,7 +228,8 @@ namespace box2d
 		Body * body2 = luax_checktype<Body>(L, 2, "Body", PHYSICS_BODY_T);
 		float x = (float)luaL_checknumber(L, 3);
 		float y = (float)luaL_checknumber(L, 4);
-		WeldJoint * j = instance->newWeldJoint(body1, body2, x, y);
+		bool collideConnected = luax_optboolean(L, 5, false);
+		WeldJoint * j = instance->newWeldJoint(body1, body2, x, y, collideConnected);
 		luax_newtype(L, "WeldJoint", PHYSICS_WELD_JOINT_T, (void*)j);
 		return 1;
 	}
@@ -235,7 +242,8 @@ namespace box2d
 		float y = (float)luaL_checknumber(L, 4);
 		float ax = (float)luaL_checknumber(L, 5);
 		float ay = (float)luaL_checknumber(L, 6);
-		WheelJoint * j = instance->newWheelJoint(body1, body2, x, y, ax, ay);
+		bool collideConnected = luax_optboolean(L, 7, false);
+		WheelJoint * j = instance->newWheelJoint(body1, body2, x, y, ax, ay, collideConnected);
 		luax_newtype(L, "WheelJoint", PHYSICS_WHEEL_JOINT_T, (void*)j);
 		return 1;
 	}
@@ -249,7 +257,8 @@ namespace box2d
 		float x2 = (float)luaL_checknumber(L, 5);
 		float y2 = (float)luaL_checknumber(L, 6);
 		float maxLength = (float)luaL_checknumber(L, 7);
-		RopeJoint * j = instance->newRopeJoint(body1, body2, x1, y1, x2, y2, maxLength);
+		bool collideConnected = luax_optboolean(L, 8, false);
+		RopeJoint * j = instance->newRopeJoint(body1, body2, x1, y1, x2, y2, maxLength, collideConnected);
 		luax_newtype(L, "RopeJoint", PHYSICS_ROPE_JOINT_T, (void*)j);
 		return 1;
 	}