From 05bc8cb7d649e6ec1bea69557e7fbbe29c2e5cb9 Mon Sep 17 00:00:00 2001 From: Dane Johnson Date: Fri, 15 Apr 2022 17:51:26 -0500 Subject: [PATCH] Control the game from Lua! --- main.lua | 5 ++++- src/main.rs | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.lua b/main.lua index 5d3deda..1b79be3 100644 --- a/main.lua +++ b/main.lua @@ -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 diff --git a/src/main.rs b/src/main.rs index e063864..2da4b1e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -109,6 +109,8 @@ fn main() { let mvp = glm::perspective::(4.0/3.0, 45.0_f32.to_radians(), 0.2, 100.0); let mvp = glm::translate::(&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(),