Browse Source

Add PrismaticJoint:getMaxMotorForce

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

+ 5 - 0
src/modules/physics/box2d/PrismaticJoint.cpp

@@ -90,6 +90,11 @@ namespace box2d
 	{
 		return Physics::scaleUp(joint->GetMotorForce(inv_dt));
 	}
+	
+	float PrismaticJoint::getMaxMotorForce() const
+	{
+		return Physics::scaleUp(joint->GetMaxMotorForce());
+	}
 
 	void PrismaticJoint::enableLimit(bool limit)
 	{

+ 5 - 0
src/modules/physics/box2d/PrismaticJoint.h

@@ -91,6 +91,11 @@ namespace box2d
 		**/
 		float getMotorForce(float inv_dt) const;
 
+		/**
+		* Get the maximum motor force, usually in N.
+		**/
+		float getMaxMotorForce() const;
+
 		/**
 		* Enable/disable the joint limit.
 		**/

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

@@ -88,7 +88,7 @@ namespace box2d
 		return Physics::scaleUp(Physics::scaleUp(joint->GetMotorTorque(inv_dt)));
 	}
 	
-	float RevoluteJoint::getMaxMotorTorque()
+	float RevoluteJoint::getMaxMotorTorque() const
 	{
 		return Physics::scaleUp(Physics::scaleUp(joint->GetMaxMotorTorque()));
 	}

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

@@ -94,7 +94,7 @@ namespace box2d
 		/**
 		* Get the maximum motor torque, usually in N-m.
 		**/
-		float getMaxMotorTorque();
+		float getMaxMotorTorque() const;
 
 		/**
 		* Enable/disable the joint limit.

+ 8 - 0
src/modules/physics/box2d/wrap_PrismaticJoint.cpp

@@ -90,6 +90,13 @@ namespace box2d
 		lua_pushnumber(L, t->getMotorForce(inv_dt));
 		return 1;
 	}
+	
+	int w_PrismaticJoint_getMaxMotorForce(lua_State * L)
+	{
+		PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
+		lua_pushnumber(L, t->getMaxMotorForce());
+		return 1;
+	}
 
 	int w_PrismaticJoint_enableLimit(lua_State * L)
 	{
@@ -161,6 +168,7 @@ namespace box2d
 		{ "setMotorSpeed", w_PrismaticJoint_setMotorSpeed },
 		{ "getMotorSpeed", w_PrismaticJoint_getMotorSpeed },
 		{ "getMotorForce", w_PrismaticJoint_getMotorForce },
+		{ "getMaxMotorForce", w_PrismaticJoint_getMaxMotorForce },
 		{ "enableLimit", w_PrismaticJoint_enableLimit },
 		{ "isLimitEnabled", w_PrismaticJoint_isLimitEnabled },
 		{ "setUpperLimit", w_PrismaticJoint_setUpperLimit },

+ 1 - 0
src/modules/physics/box2d/wrap_PrismaticJoint.h

@@ -41,6 +41,7 @@ namespace box2d
 	int w_PrismaticJoint_setMotorSpeed(lua_State * L);
 	int w_PrismaticJoint_getMotorSpeed(lua_State * L);
 	int w_PrismaticJoint_getMotorForce(lua_State * L);
+	int w_PrismaticJoint_getMaxMotorForce(lua_State * L);
 	int w_PrismaticJoint_enableLimit(lua_State * L);
 	int w_PrismaticJoint_isLimitEnabled(lua_State * L);
 	int w_PrismaticJoint_setUpperLimit(lua_State * L);