Commits

Bill Meltsner  committed d10c0e2

Add basic EdgeShape (todo: all edge-related functionality) and further integrated the new Joints

  • Participants
  • Parent commits 9610f17
  • Branches box2d-update

Comments (0)

Files changed (13)

File platform/macosx/love.xcodeproj/project.pbxproj

 		A96F41861412AFF80067FE9A /* WeldJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A96F41841412AFEB0067FE9A /* WeldJoint.cpp */; };
 		A96F41891412B36D0067FE9A /* wrap_WheelJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A96F41871412B35B0067FE9A /* wrap_WheelJoint.cpp */; };
 		A96F418C1412B3AD0067FE9A /* WheelJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A96F418A1412B3A30067FE9A /* WheelJoint.cpp */; };
+		A96F41A41412C91F0067FE9A /* EdgeShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A96F41A21412C91E0067FE9A /* EdgeShape.cpp */; };
+		A96F41A71412C92B0067FE9A /* wrap_EdgeShape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A96F41A51412C92B0067FE9A /* wrap_EdgeShape.cpp */; };
 		A986DEB5113249A800810279 /* Thread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A986DEB1113249A800810279 /* Thread.cpp */; };
 		A986DEB6113249A800810279 /* wrap_Thread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A986DEB3113249A800810279 /* wrap_Thread.cpp */; };
 		A986EC64132CE6DB00F048C8 /* b2BroadPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A986EBC8132CE6D800F048C8 /* b2BroadPhase.cpp */; };
 		A96F41881412B3610067FE9A /* wrap_WheelJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_WheelJoint.h; sourceTree = "<group>"; };
 		A96F418A1412B3A30067FE9A /* WheelJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WheelJoint.cpp; sourceTree = "<group>"; };
 		A96F418B1412B3A80067FE9A /* WheelJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WheelJoint.h; sourceTree = "<group>"; };
+		A96F41A21412C91E0067FE9A /* EdgeShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EdgeShape.cpp; sourceTree = "<group>"; };
+		A96F41A31412C91E0067FE9A /* EdgeShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EdgeShape.h; sourceTree = "<group>"; };
+		A96F41A51412C92B0067FE9A /* wrap_EdgeShape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_EdgeShape.cpp; sourceTree = "<group>"; };
+		A96F41A61412C92B0067FE9A /* wrap_EdgeShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_EdgeShape.h; sourceTree = "<group>"; };
 		A97E3842132A9EDE00198A2F /* love-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "love-Info.plist"; sourceTree = "<group>"; };
 		A986DEB1113249A800810279 /* Thread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Thread.cpp; sourceTree = "<group>"; };
 		A986DEB2113249A800810279 /* Thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Thread.h; sourceTree = "<group>"; };
 				A93E6AF010420AC7007D418B /* Contact.h */,
 				A93E6AF110420AC7007D418B /* DistanceJoint.cpp */,
 				A93E6AF210420AC7007D418B /* DistanceJoint.h */,
+				A96F41A21412C91E0067FE9A /* EdgeShape.cpp */,
+				A96F41A31412C91E0067FE9A /* EdgeShape.h */,
 				A986ECAD132CEB9300F048C8 /* Fixture.cpp */,
 				A986ECAE132CEB9B00F048C8 /* Fixture.h */,
 				A9B6432A13BF833900DC3C7E /* FrictionJoint.cpp */,
 				A93E6B5510420ACA007D418B /* wrap_Contact.h */,
 				A93E6B5610420ACA007D418B /* wrap_DistanceJoint.cpp */,
 				A93E6B5710420ACA007D418B /* wrap_DistanceJoint.h */,
+				A96F41A51412C92B0067FE9A /* wrap_EdgeShape.cpp */,
+				A96F41A61412C92B0067FE9A /* wrap_EdgeShape.h */,
 				A9B6432D13BF87E400DC3C7E /* wrap_FrictionJoint.cpp */,
 				A9B6432E13BF87EA00DC3C7E /* wrap_FrictionJoint.h */,
 				A93E6B5810420ACA007D418B /* wrap_GearJoint.cpp */,
 				A96F41861412AFF80067FE9A /* WeldJoint.cpp in Sources */,
 				A96F41891412B36D0067FE9A /* wrap_WheelJoint.cpp in Sources */,
 				A96F418C1412B3AD0067FE9A /* WheelJoint.cpp in Sources */,
+				A96F41A41412C91F0067FE9A /* EdgeShape.cpp in Sources */,
+				A96F41A71412C92B0067FE9A /* wrap_EdgeShape.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

File src/modules/physics/box2d/CircleShape.cpp

     {
         return shape->m_radius;
     }
-    
-    /**
-     * Gets the radius for the circle.
-     **/
+	
     void CircleShape::setRadius(float r)
     {
         shape->m_radius = r;

File src/modules/physics/box2d/EdgeShape.cpp

+/**
+* Copyright (c) 2006-2011 LOVE Development Team
+* 
+* This software is provided 'as-is', without any express or implied
+* warranty.  In no event will the authors be held liable for any damages
+* arising from the use of this software.
+* 
+* Permission is granted to anyone to use this software for any purpose,
+* including commercial applications, and to alter it and redistribute it
+* freely, subject to the following restrictions:
+* 
+* 1. The origin of this software must not be misrepresented; you must not
+*    claim that you wrote the original software. If you use this software
+*    in a product, an acknowledgment in the product documentation would be
+*    appreciated but is not required.
+* 2. Altered source versions must be plainly marked as such, and must not be
+*    misrepresented as being the original software.
+* 3. This notice may not be removed or altered from any source distribution.
+**/
+
+#include "EdgeShape.h"
+
+// Module
+#include "Body.h"
+#include "World.h"
+
+namespace love
+{
+namespace physics
+{
+namespace box2d
+{
+	EdgeShape::EdgeShape(b2EdgeShape * e)
+	{
+		shape = e;
+	}
+
+	EdgeShape::~EdgeShape()
+	{
+	}
+
+} // box2d
+} // physics
+} // love

File src/modules/physics/box2d/EdgeShape.h

+/**
+* Copyright (c) 2006-2011 LOVE Development Team
+* 
+* This software is provided 'as-is', without any express or implied
+* warranty.  In no event will the authors be held liable for any damages
+* arising from the use of this software.
+* 
+* Permission is granted to anyone to use this software for any purpose,
+* including commercial applications, and to alter it and redistribute it
+* freely, subject to the following restrictions:
+* 
+* 1. The origin of this software must not be misrepresented; you must not
+*    claim that you wrote the original software. If you use this software
+*    in a product, an acknowledgment in the product documentation would be
+*    appreciated but is not required.
+* 2. Altered source versions must be plainly marked as such, and must not be
+*    misrepresented as being the original software.
+* 3. This notice may not be removed or altered from any source distribution.
+**/
+
+#ifndef LOVE_PHYSICS_BOX2D_EDGE_SHAPE_H
+#define LOVE_PHYSICS_BOX2D_EDGE_SHAPE_H
+
+// Module
+#include "Shape.h"
+
+namespace love
+{
+namespace physics
+{
+namespace box2d
+{
+	/**
+	* An Edge is just a line segment. Edges are designed to
+	* be connected and/or chained together.
+	**/
+	class EdgeShape : public Shape
+	{
+	public:
+
+		/**
+		* Create a new EdgeShape from a Box2D edge shape.
+		* @param e The edge shape.
+		**/
+		EdgeShape(b2EdgeShape * e);
+
+		virtual ~EdgeShape();
+	};
+
+} // box2d
+} // physics
+} // love
+
+#endif // LOVE_PHYSICS_BOX2D_EDGE_SHAPE_H

File src/modules/physics/box2d/Physics.cpp

 		return new Body(world, b2Vec2(0, 0), 1, 1);
 	}
 
-	CircleShape * Physics::newCircleShape(Body * body, float radius)
+	CircleShape * Physics::newCircleShape(float radius)
 	{
-		return newCircleShape(body, 0, 0, radius);
+		return newCircleShape(0, 0, radius);
 	}
 
-	CircleShape * Physics::newCircleShape(Body * body, float x, float y, float radius)
+	CircleShape * Physics::newCircleShape(float x, float y, float radius)
 	{
-		b2CircleDef def;
-		def.density = 1.0f;
-		def.localPosition.Set(x, y);
-		def.friction = 0.5f;
-		def.restitution = 0.1f;
-		def.radius = radius;
-		return new CircleShape(body, &def);
+		b2CircleShape s;
+		s.m_p = b2Vec2(x, y);
+		s.m_radius = radius;
+		return new CircleShape(&s);
 	}
 
 	PolygonShape * Physics::newRectangleShape(float w, float h)
 	{
-		return newRectangleShape(body, 0, 0, w, h, 0);
+		return newRectangleShape(0, 0, w, h, 0);
 	}
 
 	PolygonShape * Physics::newRectangleShape(float x, float y, float w, float h)
 	{
-		return newRectangleShape(body, x, y, w, h, 0);
+		return newRectangleShape(x, y, w, h, 0);
 	}
 
 	PolygonShape * Physics::newRectangleShape(float x, float y, float w, float h, float angle)
 		return new PolygonShape(&s);
 	}
 	
-	PolygonShape * Physics::newEdgeShape(float x1, float y1, float x2, float y2)
+	EdgeShape * Physics::newEdgeShape(float x1, float y1, float x2, float y2)
 	{
-		b2PolygonShape s;
-		s.SetAsEdge(b2vec2(x1, y1), b2vec2(x2, y2));
-		return new PolygonShape(&s);
+		b2EdgeShape s;
+		s.Set(b2Vec2(x1, y1), b2Vec2(x2, y2));
+		return new EdgeShape(&s);
 	}
 
 	int Physics::newPolygonShape(lua_State * L)
 	{
 		return new FrictionJoint(body1, body2, x, y);
 	}
+	
+	WeldJoint * Physics::newWeldJoint(Body * body1, Body * body2, float x, float y)
+	{
+		return new WeldJoint(body1, body2, x, y);
+	}
+	
+	WheelJoint * Physics::newWheelJoint(Body * body1, Body * body2, float x, float y, float ax, float ay)
+	{
+		return new WheelJoint(body1, body2, x, y, ax, ay);
+	}
 
 } // box2d
 } // physics

File src/modules/physics/box2d/Physics.h

 #include "Shape.h"
 #include "CircleShape.h"
 #include "PolygonShape.h"
+#include "EdgeShape.h"
 #include "Joint.h"
 #include "MouseJoint.h"
 #include "DistanceJoint.h"
 #include "PulleyJoint.h"
 #include "GearJoint.h"
 #include "FrictionJoint.h"
+#include "WeldJoint.h"
+#include "WheelJoint.h"
 
 namespace love
 {
 		Body * newBody(World * world);
 
 		/**
-		* Creates a new CircleShape at the Body origin.
-		* @param body The Body to create the Shape on.
+		* Creates a new CircleShape at (0, 0).
 		* @param radius The radius of the circle.
 		**/
 		CircleShape * newCircleShape(float radius);
 
 		/**
-		* Creates a new CircleShape at (x,y) in local coorinates.
-		* @param body The Body to create the Shape on.
+		* Creates a new CircleShape at (x,y) in local coordinates.
 		* @param x The offset along the x-axis.
 		* @param y The offset along the y-axis.
 		* @param radius The radius of the circle.
 		PolygonShape * newRectangleShape(float x, float y, float w, float h, float angle);
         
         /**
-         * Shorthand for creating edge PolygonShapes. The edge
-         * will be created at (x,y) in local coordinates.
-         * @param x The offset along the x-axis.
-         * @param y The offset along the y-axis.
-         * @param w The width of the rectangle.
-         * @param h The height of the rectangle.
-         * @param angle The angle of the rectangle. (rad)
-         **/
-		PolygonShape * newEdgeShape(float x1, float y1, float x2, float y2);
+		* Creates a new EdgeShape. The edge will be created from
+		* (x1,y1) to (x2,y2) in local coordinates.
+		* @param x1 The x coordinate of the first point.
+		* @param y1 The y coordinate of the first point.
+		* @param x2 The x coordinate of the second point.
+		* @param y2 The y coordinate of the second point.
+		**/
+		EdgeShape * newEdgeShape(float x1, float y1, float x2, float y2);
 
 		/**
 		* Creates a new PolygonShape.
-		* @param body The body to create this shape on.
 		* @param ... A variable number of vertices.
 		**/
 		int newPolygonShape(lua_State * L);
 		* @param y Anchor along the y-axis. (World coordinates)
 		**/
 		FrictionJoint * newFrictionJoint(Body * body1, Body * body2, float x, float y);
+		
+		/**
+		* 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);
+		
+		/**
+		* Creates a new WheelJoint connecting body1 with body2.
+		* @param x Anchor along the x-axis. (World coordinates)
+		* @param y Anchor along the y-axis. (World coordinates)
+		* @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);
 
 
 	}; // Physics

File src/modules/physics/box2d/Shape.cpp

 			return SHAPE_CIRCLE;
 		case b2Shape::e_polygon:
 			return SHAPE_POLYGON;
+		case b2Shape::e_edge:
+			return SHAPE_EDGE;
+		case b2Shape::e_chain:
+			return SHAPE_CHAIN;
 		default:
 			return SHAPE_INVALID;
 		}

File src/modules/physics/box2d/wrap_EdgeShape.cpp

+/**
+* Copyright (c) 2006-2011 LOVE Development Team
+*
+* This software is provided 'as-is', without any express or implied
+* warranty.  In no event will the authors be held liable for any damages
+* arising from the use of this software.
+*
+* Permission is granted to anyone to use this software for any purpose,
+* including commercial applications, and to alter it and redistribute it
+* freely, subject to the following restrictions:
+*
+* 1. The origin of this software must not be misrepresented; you must not
+*    claim that you wrote the original software. If you use this software
+*    in a product, an acknowledgment in the product documentation would be
+*    appreciated but is not required.
+* 2. Altered source versions must be plainly marked as such, and must not be
+*    misrepresented as being the original software.
+* 3. This notice may not be removed or altered from any source distribution.
+**/
+
+#include "wrap_EdgeShape.h"
+
+namespace love
+{
+namespace physics
+{
+namespace box2d
+{
+	EdgeShape * luax_checkedgeshape(lua_State * L, int idx)
+	{
+		return luax_checktype<EdgeShape>(L, idx, "EdgeShape", PHYSICS_EDGE_SHAPE_T);
+	}
+
+	static const luaL_Reg functions[] = {
+		// From Shape.
+		{ "getType", w_Shape_getType },
+		{ "destroy", w_Shape_destroy },
+		{ 0, 0 }
+	};
+
+	int luaopen_edgeshape(lua_State * L)
+	{
+		return luax_register_type(L, "EdgeShape", functions);
+	}
+
+} // box2d
+} // physics
+} // love

File src/modules/physics/box2d/wrap_EdgeShape.h

+/**
+* Copyright (c) 2006-2011 LOVE Development Team
+* 
+* This software is provided 'as-is', without any express or implied
+* warranty.  In no event will the authors be held liable for any damages
+* arising from the use of this software.
+* 
+* Permission is granted to anyone to use this software for any purpose,
+* including commercial applications, and to alter it and redistribute it
+* freely, subject to the following restrictions:
+* 
+* 1. The origin of this software must not be misrepresented; you must not
+*    claim that you wrote the original software. If you use this software
+*    in a product, an acknowledgment in the product documentation would be
+*    appreciated but is not required.
+* 2. Altered source versions must be plainly marked as such, and must not be
+*    misrepresented as being the original software.
+* 3. This notice may not be removed or altered from any source distribution.
+**/
+
+#ifndef LOVE_PHYSICS_BOX2D_WRAP_EDGE_SHAPE_H
+#define LOVE_PHYSICS_BOX2D_WRAP_EDGE_SHAPE_H
+
+// LOVE
+#include <common/runtime.h>
+#include "wrap_Shape.h"
+#include "EdgeShape.h"
+
+namespace love
+{
+namespace physics
+{
+namespace box2d
+{
+	EdgeShape * luax_checkedgeshape(lua_State * L, int idx);
+	int luaopen_edgeshape(lua_State * L);
+
+} // box2d
+} // physics
+} // love
+
+#endif // LOVE_PHYSICS_BOX2D_WRAP_EDGE_SHAPE_H

File src/modules/physics/box2d/wrap_Physics.cpp

 		float y1 = (float)luaL_checknumber(L, 2);
 		float x2 = (float)luaL_checknumber(L, 3);
 		float y2 = (float)luaL_checknumber(L, 4);
-		PolygonShape * shape = instance->newEdgeShape(x1, y1, x2, y2);
-		luax_newtype(L, "PolygonShape", PHYSICS_POLYGON_SHAPE_T, (void*)shape);
+		EdgeShape * shape = instance->newEdgeShape(x1, y1, x2, y2);
+		luax_newtype(L, "EdgeShape", PHYSICS_EDGE_SHAPE_T, (void*)shape);
 		return 1;
 	}
 
 		luax_newtype(L, "FrictionJoint", PHYSICS_FRICTION_JOINT_T, (void*)j);
 		return 1;
 	}
+	
+	int w_newWeldJoint(lua_State * L)
+	{
+		Body * body1 = luax_checktype<Body>(L, 1, "Body", PHYSICS_BODY_T);
+		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);
+		luax_newtype(L, "WeldJoint", PHYSICS_WELD_JOINT_T, (void*)j);
+		return 1;
+	}
+	
+	int w_newWheelJoint(lua_State * L)
+	{
+		Body * body1 = luax_checktype<Body>(L, 1, "Body", PHYSICS_BODY_T);
+		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);
+		float ax = (float)luaL_checknumber(L, 5);
+		float ay = (float)luaL_checknumber(L, 6);
+		WheelJoint * j = instance->newWheelJoint(body1, body2, x, y, ax, ay);
+		luax_newtype(L, "WheelJoint", PHYSICS_WHEEL_JOINT_T, (void*)j);
+		return 1;
+	}
 
 	// List of functions to wrap.
 	static const luaL_Reg functions[] = {
 		{ "newCircleShape", w_newCircleShape },
 		{ "newRectangleShape", w_newRectangleShape },
 		{ "newPolygonShape", w_newPolygonShape },
+		{ "newEdgeShape", w_newEdgeShape },
 		{ "newDistanceJoint", w_newDistanceJoint },
 		{ "newMouseJoint", w_newMouseJoint },
 		{ "newRevoluteJoint", w_newRevoluteJoint },
 		{ "newPulleyJoint", w_newPulleyJoint },
 		{ "newGearJoint", w_newGearJoint },
 		{ "newFrictionJoint", w_newFrictionJoint },
+		{ "newWeldJoint", w_newWeldJoint },
+		{ "newWheelJoint", w_newWheelJoint },
 		{ 0, 0 },
 	};
 
 		luaopen_shape,
 		luaopen_circleshape,
 		luaopen_polygonshape,
+		luaopen_edgeshape,
 		luaopen_joint,
 		luaopen_mousejoint,
 		luaopen_distancejoint,
 		luaopen_pulleyjoint,
 		luaopen_gearjoint,
 		luaopen_frictionjoint,
+		luaopen_weldjoint,
 		0
 	};
 

File src/modules/physics/box2d/wrap_Physics.h

 #include "wrap_Shape.h"
 #include "wrap_CircleShape.h"
 #include "wrap_PolygonShape.h"
+#include "wrap_EdgeShape.h"
 #include "wrap_Joint.h"
 #include "wrap_MouseJoint.h"
 #include "wrap_DistanceJoint.h"
 #include "wrap_PulleyJoint.h"
 #include "wrap_GearJoint.h"
 #include "wrap_FrictionJoint.h"
+#include "wrap_WeldJoint.h"
+#include "wrap_WheelJoint.h"
 
 namespace love
 {
 	int w_newBody(lua_State * L);
 	int w_newCircleShape(lua_State * L);
 	int w_newRectangleShape(lua_State * L);
+	int w_newPolygonShape(lua_State * L);
     int w_newEdgeShape(lua_State * L);
-	int w_newPolygonShape(lua_State * L);
 	int w_newDistanceJoint(lua_State * L);
 	int w_newMouseJoint(lua_State * L);
 	int w_newRevoluteJoint(lua_State * L);
 	int w_newPulleyJoint(lua_State * L);
 	int w_newGearJoint(lua_State * L);
 	int w_newFrictionJoint(lua_State * L);
+	int w_newWeldJoint(lua_State * L);
+	int w_newWheelJoint(lua_State * L);
 	extern "C" LOVE_EXPORT int luaopen_love_physics(lua_State * L);
 
 } // box2d

File src/modules/physics/box2d/wrap_WheelJoint.cpp

 * 3. This notice may not be removed or altered from any source distribution.
 **/
 
-#include "wrap_PrismaticJoint.h"
+#include "wrap_WheelJoint.h"
 
 namespace love
 {
 {
 namespace box2d
 {
-	PrismaticJoint * luax_checkprismaticjoint(lua_State * L, int idx)
+	WheelJoint * luax_checkwheeljoint(lua_State * L, int idx)
 	{
-		return luax_checktype<PrismaticJoint>(L, idx, "PrismaticJoint", PHYSICS_PRISMATIC_JOINT_T);
+		return luax_checktype<WheelJoint>(L, idx, "WheelJoint", PHYSICS_WHEEL_JOINT_T);
 	}
 
-	int w_PrismaticJoint_getJointTranslation(lua_State * L)
+	int w_WheelJoint_getJointTranslation(lua_State * L)
 	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
 		lua_pushnumber(L, t->getJointTranslation());
 		return 1;
 	}
 
-	int w_PrismaticJoint_getJointSpeed(lua_State * L)
+	int w_WheelJoint_getJointSpeed(lua_State * L)
 	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
 		lua_pushnumber(L, t->getJointSpeed());
 		return 1;
 	}
 
-	int w_PrismaticJoint_enableMotor(lua_State * L)
+	int w_WheelJoint_enableMotor(lua_State * L)
 	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
 		bool arg1 = luax_toboolean(L, 2);
 		t->enableMotor(arg1);
 		return 0;
 	}
 
-	int w_PrismaticJoint_isMotorEnabled(lua_State * L)
+	int w_WheelJoint_isMotorEnabled(lua_State * L)
 	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
 		luax_pushboolean(L, t->isMotorEnabled());
 		return 1;
 	}
 
-	int w_PrismaticJoint_setMaxMotorForce(lua_State * L)
+	int w_WheelJoint_setMotorSpeed(lua_State * L)
 	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
-		float arg1 = (float)luaL_checknumber(L, 2);
-		t->setMaxMotorForce(arg1);
-		return 0;
-	}
-
-	int w_PrismaticJoint_setMotorSpeed(lua_State * L)
-	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
 		float arg1 = (float)luaL_checknumber(L, 2);
 		t->setMotorSpeed(arg1);
 		return 0;
 	}
 
-	int w_PrismaticJoint_getMotorSpeed(lua_State * L)
+	int w_WheelJoint_getMotorSpeed(lua_State * L)
 	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
 		lua_pushnumber(L, t->getMotorSpeed());
 		return 1;
 	}
-
-	int w_PrismaticJoint_getMotorForce(lua_State * L)
+	
+	int w_WheelJoint_setMaxMotorTorque(lua_State * L)
 	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
-		lua_pushnumber(L, t->getMotorForce());
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
+		float arg1 = (float)luaL_checknumber(L, 2);
+		t->setMaxMotorTorque(arg1);
+		return 0;
+	}
+	
+	int w_WheelJoint_getMaxMotorTorque(lua_State * L)
+	{
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
+		lua_pushnumber(L, t->getMaxMotorTorque());
+		return 1;
+	}
+	
+	int w_WheelJoint_getMotorTorque(lua_State * L)
+	{
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
+		float inv_dt = (float)luaL_checknumber(L, 2);
+		lua_pushnumber(L, t->getMotorTorque(inv_dt));
+		return 1;
+	}
+	
+	int w_WheelJoint_setSpringFrequencyHz(lua_State * L)
+	{
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
+		float arg1 = (float)luaL_checknumber(L, 2);
+		t->setSpringFrequencyHz(arg1);
+		return 0;
+	}
+	
+	int w_WheelJoint_getSpringFrequencyHz(lua_State * L)
+	{
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
+		lua_pushnumber(L, t->getSpringFrequencyHz());
+		return 1;
+	}
+	
+	int w_WheelJoint_setSpringDampingRatio(lua_State * L)
+	{
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
+		float arg1 = (float)luaL_checknumber(L, 2);
+		t->setSpringDampingRatio(arg1);
+		return 0;
+	}
+	
+	int w_WheelJoint_getSpringDampingRatio(lua_State * L)
+	{
+		WheelJoint * t = luax_checkwheeljoint(L, 1);
+		lua_pushnumber(L, t->getSpringDampingRatio());
 		return 1;
 	}
 
-	int w_PrismaticJoint_enableLimit(lua_State * L)
-	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
-		bool arg1 = luax_toboolean(L, 2);
-		t->enableLimit(arg1);
-		return 0;
-	}
-
-	int w_PrismaticJoint_isLimitEnabled(lua_State * L)
-	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
-		luax_pushboolean(L, t->isLimitEnabled());
-		return 1;
-	}
-
-	int w_PrismaticJoint_setUpperLimit(lua_State * L)
-	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
-		float arg1 = (float)luaL_checknumber(L, 2);
-		t->setUpperLimit(arg1);
-		return 0;
-	}
-
-	int w_PrismaticJoint_setLowerLimit(lua_State * L)
-	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
-		float arg1 = (float)luaL_checknumber(L, 2);
-		t->setLowerLimit(arg1);
-		return 0;
-	}
-
-	int w_PrismaticJoint_setLimits(lua_State * L)
-	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
-		float arg1 = (float)luaL_checknumber(L, 2);
-		float arg2 = (float)luaL_checknumber(L, 3);
-		t->setLimits(arg1, arg2);
-		return 0;
-	}
-
-	int w_PrismaticJoint_getLowerLimit(lua_State * L)
-	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
-		lua_pushnumber(L, t->getLowerLimit());
-		return 1;
-	}
-
-	int w_PrismaticJoint_getUpperLimit(lua_State * L)
-	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
-		lua_pushnumber(L, t->getUpperLimit());
-		return 1;
-	}
-
-	int w_PrismaticJoint_getLimits(lua_State * L)
-	{
-		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
-		lua_remove(L, 1);
-		return t->getLimits(L);
-	}
-
 	static const luaL_Reg functions[] = {
-		{ "getJointTranslation", w_PrismaticJoint_getJointTranslation },
-		{ "getJointSpeed", w_PrismaticJoint_getJointSpeed },
-		{ "enableMotor", w_PrismaticJoint_enableMotor },
-		{ "isMotorEnabled", w_PrismaticJoint_isMotorEnabled },
-		{ "setMaxMotorForce", w_PrismaticJoint_setMaxMotorForce },
-		{ "setMotorSpeed", w_PrismaticJoint_setMotorSpeed },
-		{ "getMotorSpeed", w_PrismaticJoint_getMotorSpeed },
-		{ "getMotorForce", w_PrismaticJoint_getMotorForce },
-		{ "enableLimit", w_PrismaticJoint_enableLimit },
-		{ "isLimitEnabled", w_PrismaticJoint_isLimitEnabled },
-		{ "setUpperLimit", w_PrismaticJoint_setUpperLimit },
-		{ "setLowerLimit", w_PrismaticJoint_setLowerLimit },
-		{ "setLimits", w_PrismaticJoint_setLimits },
-		{ "getLowerLimit", w_PrismaticJoint_getLowerLimit },
-		{ "getUpperLimit", w_PrismaticJoint_getUpperLimit },
-		{ "getLimits", w_PrismaticJoint_getLimits },
+		{ "getJointTranslation", w_WheelJoint_getJointTranslation },
+		{ "getJointSpeed", w_WheelJoint_getJointSpeed },
+		{ "enableMotor", w_WheelJoint_enableMotor },
+		{ "isMotorEnabled", w_WheelJoint_isMotorEnabled },
+		{ "setMotorSpeed", w_WheelJoint_setMotorSpeed },
+		{ "getMotorSpeed", w_WheelJoint_getMotorSpeed },
+		{ "setMaxMotorTorque", w_WheelJoint_setMaxMotorTorque },
+		{ "getMaxMotorTorque", w_WheelJoint_getMaxMotorTorque },
+		{ "getMotorTorque", w_WheelJoint_getMotorTorque },
+		{ "setSpringFrequencyHz", w_WheelJoint_setSpringFrequencyHz },
+		{ "getSpringFrequencyHz", w_WheelJoint_getSpringFrequencyHz },
+		{ "setSpringDampingRatio", w_WheelJoint_setSpringDampingRatio },
+		{ "getSpringDampingRatio", w_WheelJoint_getSpringDampingRatio },
 		// From Joint.
 		{ "getType", w_Joint_getType },
 		{ "getAnchors", w_Joint_getAnchors },
 		{ 0, 0 }
 	};
 
-	int luaopen_prismaticjoint(lua_State * L)
+	int luaopen_wheeljoint(lua_State * L)
 	{
-		return luax_register_type(L, "PrismaticJoint", functions);
+		return luax_register_type(L, "WheelJoint", functions);
 	}
 
 } // box2d

File src/modules/physics/box2d/wrap_WheelJoint.h

 * 3. This notice may not be removed or altered from any source distribution.
 **/
 
-#ifndef LOVE_PHYSICS_BOX2D_WRAP_PRISMATIC_JOINT_H
-#define LOVE_PHYSICS_BOX2D_WRAP_PRISMATIC_JOINT_H
+#ifndef LOVE_PHYSICS_BOX2D_WRAP_WHEEL_JOINT_H
+#define LOVE_PHYSICS_BOX2D_WRAP_WHEEL_JOINT_H
 
 // LOVE
 #include <common/runtime.h>
 #include "wrap_Joint.h"
-#include "PrismaticJoint.h"
+#include "WheelJoint.h"
 
 namespace love
 {
 {
 namespace box2d
 {
-	PrismaticJoint * luax_checkprismaticjoint(lua_State * L, int idx);
-	int w_PrismaticJoint_getJointTranslation(lua_State * L);
-	int w_PrismaticJoint_getJointSpeed(lua_State * L);
-	int w_PrismaticJoint_enableMotor(lua_State * L);
-	int w_PrismaticJoint_isMotorEnabled(lua_State * L);
-	int w_PrismaticJoint_setMaxMotorForce(lua_State * L);
-	int w_PrismaticJoint_setMotorSpeed(lua_State * L);
-	int w_PrismaticJoint_getMotorSpeed(lua_State * L);
-	int w_PrismaticJoint_getMotorForce(lua_State * L);
-	int w_PrismaticJoint_enableLimit(lua_State * L);
-	int w_PrismaticJoint_isLimitEnabled(lua_State * L);
-	int w_PrismaticJoint_setUpperLimit(lua_State * L);
-	int w_PrismaticJoint_setLowerLimit(lua_State * L);
-	int w_PrismaticJoint_setLimits(lua_State * L);
-	int w_PrismaticJoint_getLowerLimit(lua_State * L);
-	int w_PrismaticJoint_getUpperLimit(lua_State * L);
-	int w_PrismaticJoint_getLimits(lua_State * L);
-	int luaopen_prismaticjoint(lua_State * L);
+	WheelJoint * luax_checkwheeljoint(lua_State * L, int idx);
+	int w_WheelJoint_getJointTranslation(lua_State * L);
+	int w_WheelJoint_getJointSpeed(lua_State * L);
+	int w_WheelJoint_enableMotor(lua_State * L);
+	int w_WheelJoint_isMotorEnabled(lua_State * L);
+	int w_WheelJoint_setMotorSpeed(lua_State * L);
+	int w_WheelJoint_getMotorSpeed(lua_State * L);
+	int w_WheelJoint_setMaxMotorTorque(lua_State * L);
+	int w_WheelJoint_getMaxMotorTorque(lua_State * L);
+	int w_WheelJoint_getMotorTorque(lua_State * L);
+	int w_WheelJoint_setSpringFrequencyHz(lua_State * L);
+	int w_WheelJoint_getSpringFrequencyHz(lua_State * L);
+	int w_WheelJoint_setSpringDampingRatio(lua_State * L);
+	int w_WheelJoint_getSpringDampingRatio(lua_State * L);
+	int luaopen_wheeljoint(lua_State * L);
 
 } // box2d
 } // physics
 } // love
 
-#endif // LOVE_PHYSICS_BOX2D_WRAP_PRISMATIC_JOINT_H
+#endif // LOVE_PHYSICS_BOX2D_WRAP_WHEEL_JOINT_H