add rigidbody.is_grounded
This commit is contained in:
parent
f4653878a2
commit
371acf0008
@ -24,6 +24,7 @@ local Rigidbody = {__index={
|
||||
set_gravity_scale=function(self, s) return __rigidbody.set_gravity_scale(self.eid, s) end,
|
||||
is_vdamping=function(self) return __rigidbody.is_vdamping(self.eid) end,
|
||||
set_vdamping=function(self, b) return __rigidbody.set_vdamping(self.eid, b) end,
|
||||
is_grounded=function(self) return __rigidbody.is_grounded(self.eid) end,
|
||||
}}
|
||||
|
||||
local function new_Rigidbody(eid)
|
||||
|
||||
@ -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}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user