mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Merge pull request #822 from MihailRis/get-ground-vel
entity.rigidbody:get_ground_vel()
This commit is contained in:
commit
8d792a6730
5 changed files with 17 additions and 0 deletions
|
|
@ -78,6 +78,7 @@ Table of contents:
|
|||
- entity.rigidbody:set_elasticity
|
||||
- entity.rigidbody:set_mass
|
||||
- entity.rigidbody:set_material
|
||||
- entity.rigidbody:get_ground_vel
|
||||
- gfx.blockwraps.set_faces
|
||||
- gfx.blockwraps.set_tints
|
||||
- gui.close_menu
|
||||
|
|
|
|||
|
|
@ -129,6 +129,9 @@ body:set_mass(mass: number)
|
|||
body:get_elasticity() -> number
|
||||
-- Sets the body's elasticity
|
||||
body:set_elasticity(elasticity: number)
|
||||
|
||||
-- Returns the velocity of the surface the body is on, or {0,0,0}
|
||||
body:get_ground_vel() -> vec3
|
||||
```
|
||||
|
||||
### Skeleton
|
||||
|
|
|
|||
|
|
@ -129,6 +129,9 @@ body:set_mass(mass: number)
|
|||
body:get_elasticity() -> number
|
||||
-- Устанавливает упругость тела
|
||||
body:set_elasticity(elasticity: number)
|
||||
|
||||
-- Возвращает скорость поверхности, на которой находится тело, либо {0,0,0}
|
||||
body:get_ground_vel() -> vec3
|
||||
```
|
||||
|
||||
### Skeleton
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ local Rigidbody = {__index={
|
|||
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_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)
|
||||
|
|
|
|||
|
|
@ -192,6 +192,14 @@ static int l_set_elasticity(lua::State* L) {
|
|||
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[] = {
|
||||
{"is_enabled", lua::wrap<l_is_enabled>},
|
||||
{"set_enabled", lua::wrap<l_set_enabled>},
|
||||
|
|
@ -217,5 +225,6 @@ const luaL_Reg rigidbodylib[] = {
|
|||
{"set_mass", lua::wrap<l_set_mass>},
|
||||
{"get_elasticity", lua::wrap<l_get_elasticity>},
|
||||
{"set_elasticity", lua::wrap<l_set_elasticity>},
|
||||
{"get_ground_vel", lua::wrap<l_get_ground_vel>},
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue