From eb79ed0b660d86a70918f9ac52df4419215b25f4 Mon Sep 17 00:00:00 2001 From: CobaltXII Date: Tue, 1 Jan 2019 12:14:30 -0500 Subject: [PATCH] Improved documentation --- src/main.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b9ff2ce..d08ba0a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -430,7 +430,7 @@ int main(int argc, char** argv) hitbox player_hitbox = hitbox(player_x, player_y, player_z, 0.6f, 1.8f, 0.6f); - // Do collision detection. + // Do collision detection and response. player_hitbox.x += player_vx; @@ -478,7 +478,7 @@ int main(int argc, char** argv) player_y = player_hitbox.y; player_z = player_hitbox.z; - // Stupid testing. + // Block placement and deletion testing. if ((sdl_mouse_l || sdl_mouse_r) && block_timer == 0) { @@ -598,7 +598,10 @@ int main(int argc, char** argv) matrix_view = glm::rotate(matrix_view, glm::radians(rot_x_deg), glm::vec3(1.0f, 0.0f, 0.0f)); matrix_view = glm::rotate(matrix_view, glm::radians(rot_y_deg), glm::vec3(0.0f, 1.0f, 0.0f)); - // Generate the model matrix. + // Generate the model matrix. The translation component must + // be centered around the X and Z axes of the player hitbox, + // and must be a small amount lower than the top of the player + // hitbox. glm::mat4 matrix_model = glm::translate(glm::mat4(1.0f), glm::vec3(-player_x - player_hitbox.xr / 2.0f, player_y + 0.2f, -player_z - player_hitbox.zr / 2.0f));