int w_Body_applyImpulse(lua_State * L) { Body * t = luax_checkbody(L, 1); float jx = (float)luaL_checknumber(L, 2); float jy = (float)luaL_checknumber(L, 3); if(lua_gettop(L) == 3) { t->applyImpulse(jx, jy); } else if(lua_gettop(L) == 5) { float rx = (float)luaL_checknumber(L, 4); float ry = (float)luaL_checknumber(L, 5); t->applyImpulse(jx, jy, rx, ry); } else { return luaL_error(L, "Wrong number of parameters."); } return 0; }
void InputForceGenerator::applyForce(Body& body) const { body.applyImpulse(mImpulse); mImpulse = Vector::zero(); }