add rigidbody.is_grounded

This commit is contained in:
MihailRis
2024-07-09 04:41:37 +03:00
parent f4653878a2
commit 371acf0008
2 changed files with 9 additions and 0 deletions
@@ -70,6 +70,13 @@ static int l_rigidbody_set_vdamping(lua::State* L) {
return 0;
}
static int l_rigidbody_is_grounded(lua::State* L) {
if (auto entity = get_entity(L, 1)) {
return lua::pushboolean(L, entity->getRigidbody().hitbox.grounded);
}
return 0;
}
const luaL_Reg rigidbodylib [] = {
{"is_enabled", lua::wrap<l_rigidbody_is_enabled>},
{"set_enabled", lua::wrap<l_rigidbody_set_enabled>},
@@ -81,5 +88,6 @@ const luaL_Reg rigidbodylib [] = {
{"set_gravity_scale", lua::wrap<l_rigidbody_set_gravity_scale>},
{"is_vdamping", lua::wrap<l_rigidbody_is_vdamping>},
{"set_vdamping", lua::wrap<l_rigidbody_set_vdamping>},
{"is_grounded", lua::wrap<l_rigidbody_is_grounded>},
{NULL, NULL}
};