Control the game from Lua!

This commit is contained in:
Dane Johnson 2022-04-15 17:51:26 -05:00
parent c9ebd3fefe
commit 05bc8cb7d6
2 changed files with 6 additions and 1 deletions

View File

@ -7,5 +7,8 @@ function init()
end
function update(delta)
print(couch.root:find_node("cube"):get_transform().position[3])
local transform = couch.root:find_node("cube"):get_transform()
transform.rotation[2] = transform.rotation[2] + delta
transform.rotation[1] = transform.rotation[1] - delta * 0.3
couch.root:find_node("cube"):set_transform(transform)
end

View File

@ -109,6 +109,8 @@ fn main() {
let mvp = glm::perspective::<f32>(4.0/3.0, 45.0_f32.to_radians(), 0.2, 100.0);
let mvp = glm::translate::<f32>(&mvp, &cube.get_transform().position);
let mvp = glm::rotate_x(&mvp, cube.get_transform().rotation.x);
let mvp = glm::rotate_y(&mvp, cube.get_transform().rotation.y);
let mvp = glm::rotate_z(&mvp, cube.get_transform().rotation.z);
let uniforms = uniform! {
MVP: *mvp.as_ref(),