Add a custom Body:setMass function.

This commit is contained in:
Linus Sjögren
2012-01-10 04:14:17 +01:00
parent be55579a22
commit afd0ef1d9e
4 changed files with 24 additions and 0 deletions
+9
View File
@@ -294,6 +294,14 @@ namespace box2d
return 0;
}
int w_Body_setMass(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float m = (float)luaL_checknumber(L, 2);
t->setMass(m);
return 0;
}
int w_Body_setInertia(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
@@ -552,6 +560,7 @@ namespace box2d
{ "setPosition", w_Body_setPosition },
{ "resetMassData", w_Body_resetMassData },
{ "setMassData", w_Body_setMassData },
{ "setMass", w_Body_setMass },
{ "setInertia", w_Body_setInertia },
{ "setAngularDamping", w_Body_setAngularDamping },
{ "setLinearDamping", w_Body_setLinearDamping },