mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 14:31:50 +00:00
add entity.rigidbody.get_ground_vel
This commit is contained in:
parent
3ab5095583
commit
1fb0eb762d
2 changed files with 10 additions and 0 deletions
|
|
@ -38,6 +38,7 @@ local Rigidbody = {__index={
|
||||||
get_elasticity=function(self) return __rigidbody.get_elasticity(self.eid) end,
|
get_elasticity=function(self) return __rigidbody.get_elasticity(self.eid) end,
|
||||||
set_mass=function(self, v) return __rigidbody.set_mass(self.eid, v) end,
|
set_mass=function(self, v) return __rigidbody.set_mass(self.eid, v) end,
|
||||||
set_elasticity=function(self, v) return __rigidbody.set_elasticity(self.eid, v) end,
|
set_elasticity=function(self, v) return __rigidbody.set_elasticity(self.eid, v) end,
|
||||||
|
get_ground_vel=function(self) return __rigidbody.get_ground_vel(self.eid) end,
|
||||||
}}
|
}}
|
||||||
|
|
||||||
local function new_Rigidbody(eid)
|
local function new_Rigidbody(eid)
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,14 @@ static int l_set_elasticity(lua::State* L) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int l_get_ground_vel(lua::State* L) {
|
||||||
|
if (auto entity = get_entity(L, 1)) {
|
||||||
|
return lua::pushvec3(L, entity->getRigidbody().hitbox.groundVelocity);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const luaL_Reg rigidbodylib[] = {
|
const luaL_Reg rigidbodylib[] = {
|
||||||
{"is_enabled", lua::wrap<l_is_enabled>},
|
{"is_enabled", lua::wrap<l_is_enabled>},
|
||||||
{"set_enabled", lua::wrap<l_set_enabled>},
|
{"set_enabled", lua::wrap<l_set_enabled>},
|
||||||
|
|
@ -217,5 +225,6 @@ const luaL_Reg rigidbodylib[] = {
|
||||||
{"set_mass", lua::wrap<l_set_mass>},
|
{"set_mass", lua::wrap<l_set_mass>},
|
||||||
{"get_elasticity", lua::wrap<l_get_elasticity>},
|
{"get_elasticity", lua::wrap<l_get_elasticity>},
|
||||||
{"set_elasticity", lua::wrap<l_set_elasticity>},
|
{"set_elasticity", lua::wrap<l_set_elasticity>},
|
||||||
|
{"get_ground_vel", lua::wrap<l_get_ground_vel>},
|
||||||
{nullptr, nullptr}
|
{nullptr, nullptr}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue