Skip to content

Commit

Permalink
Added b2d.get_angular_damping()/b2d.set_angular_damping() (defold#9367)
Browse files Browse the repository at this point in the history
  • Loading branch information
JCash authored Sep 2, 2024
1 parent 5fffb05 commit 16583ec
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions engine/gamesys/src/gamesys/scripts/box2d/script_box2d_body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,22 @@ namespace dmGameSystem
return 0;
}

static int Body_GetAngularDamping(lua_State* L)
{
DM_LUA_STACK_CHECK(L, 1);
b2Body* body = CheckBody(L, 1);
lua_pushnumber(L, body->GetAngularDamping());
return 1;
}

static int Body_SetAngularDamping(lua_State* L)
{
DM_LUA_STACK_CHECK(L, 0);
b2Body* body = CheckBody(L, 1);
body->SetAngularDamping(luaL_checknumber(L, 2));
return 0;
}

static int Body_GetGravityScale(lua_State* L)
{
DM_LUA_STACK_CHECK(L, 1);
Expand Down Expand Up @@ -523,6 +539,9 @@ namespace dmGameSystem
{"get_linear_damping", Body_GetLinearDamping},
{"set_linear_damping", Body_SetLinearDamping},

{"get_angular_damping", Body_GetAngularDamping},
{"set_angular_damping", Body_SetAngularDamping},

{"is_bullet", Body_IsBullet},
{"set_bullet", Body_SetBullet},

Expand Down

0 comments on commit 16583ec

Please sign in to comment.