mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 12:31:51 +00:00
entity.get_rot, .set_rot
This commit is contained in:
parent
20ab48ecab
commit
f70e923c7c
4 changed files with 20 additions and 3 deletions
|
|
@ -45,9 +45,25 @@ static int l_set_vel(lua::State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int l_get_rot(lua::State* L) {
|
||||
if (auto entity = get_entity(L, 1)) {
|
||||
return lua::pushmat4(L, entity->getTransform().rot);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_set_rot(lua::State* L) {
|
||||
if (auto entity = get_entity(L, 1)) {
|
||||
entity->getTransform().rot = lua::tomat4(L, 2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg entitylib [] = {
|
||||
{"spawn", lua::wrap<l_spawn>},
|
||||
{"get_vel", lua::wrap<l_get_vel>},
|
||||
{"set_vel", lua::wrap<l_set_vel>},
|
||||
{"get_rot", lua::wrap<l_get_rot>},
|
||||
{"set_rot", lua::wrap<l_set_rot>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ void Entities::updatePhysics(float delta){
|
|||
1.0f,
|
||||
true
|
||||
);
|
||||
hitbox.linear_damping = hitbox.grounded * 5;
|
||||
hitbox.linear_damping = hitbox.grounded * 12;
|
||||
transform.pos = hitbox.position;
|
||||
transform.rot = glm::rotate(glm::mat4(transform.rot), delta, glm::vec3(0, 1, 0));
|
||||
//transform.rot = glm::rotate(glm::mat4(transform.rot), delta, glm::vec3(0, 1, 0));
|
||||
if (hitbox.grounded) {
|
||||
//hitbox.velocity.y = 10;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue