From f6a125880563110fb448410fd8cdda6b1f466347 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Fri, 18 Jun 2021 16:11:23 +0200 Subject: [PATCH] [ADD] only playing after calibrating --- src/computervision/hand_detect_region.cpp | 2 +- src/entities/collision_entity.cpp | 4 ++-- src/entities/house_generator.cpp | 2 +- src/scenes/in_Game_Scene.cpp | 7 ++++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/computervision/hand_detect_region.cpp b/src/computervision/hand_detect_region.cpp index c3e4a66..c354d45 100644 --- a/src/computervision/hand_detect_region.cpp +++ b/src/computervision/hand_detect_region.cpp @@ -1,6 +1,6 @@ #include "hand_detect_region.h" -#define TIME_DURATION 1.5f +#define TIME_DURATION 1.0f namespace computervision { diff --git a/src/entities/collision_entity.cpp b/src/entities/collision_entity.cpp index 57e7b9e..ef22775 100644 --- a/src/entities/collision_entity.cpp +++ b/src/entities/collision_entity.cpp @@ -40,8 +40,8 @@ namespace entities const glm::vec3 size = bounding_box.size; - min_xyz = { bounding_box.center_pos.x - (0.5 * size.x), bounding_box.center_pos.y, bounding_box.center_pos.z + (0.5 * size.z) }; - max_xyz = { bounding_box.center_pos.x + (0.5 * size.x), bounding_box.center_pos.y + size.y, bounding_box.center_pos.z - (0.5 * size.z) }; + min_xyz = { bounding_box.center_pos.x - (0.5 * size.x), bounding_box.center_pos.y, bounding_box.center_pos.z - (0.5 * size.z) }; + max_xyz = { bounding_box.center_pos.x + (0.5 * size.x), bounding_box.center_pos.y + size.y, bounding_box.center_pos.z + (0.5 * size.z) }; // min_xyz = bounding_box.center_pos; // max_xyz = { bounding_box.center_pos.x + size.x, bounding_box.center_pos.y + size.y, bounding_box.center_pos.z + size.z }; diff --git a/src/entities/house_generator.cpp b/src/entities/house_generator.cpp index 04f52a5..562363b 100644 --- a/src/entities/house_generator.cpp +++ b/src/entities/house_generator.cpp @@ -79,7 +79,7 @@ namespace entities glm::vec3 model_pos = glm::vec3(position.x + (x * multiplier_x) - (multiplier_x / 2) - offset_x, position.y, position.z + (z * multiplier_z) - (multiplier_z / 2) + offset_z); collision::Box model_box = { model_pos, model.raw_model.model_size * HOUSE_SIZE }; - model_box.SetRotation(-90); + model_box.SetRotation(90); furniture_list->push_back(std::make_shared(model, model_pos, glm::vec3(0, -90, 0), HOUSE_SIZE, model_box)); } //} diff --git a/src/scenes/in_Game_Scene.cpp b/src/scenes/in_Game_Scene.cpp index a7b332a..72f7fd3 100644 --- a/src/scenes/in_Game_Scene.cpp +++ b/src/scenes/in_Game_Scene.cpp @@ -24,6 +24,7 @@ namespace scene int furniture_count_old; int score; int* ptr; + bool calibrated = false; float delta_time = 0; @@ -112,7 +113,7 @@ namespace scene for (int i = 0; i < furniture_count; i++) { house_models.pop_front(); - collision_entities.erase(collision_entities.begin() + 1); + collision_entities.pop_front(); } } int z_offset = model_pos * (house_generator->GetHouseDepth()); // how much "in the distance" we should load the model @@ -265,6 +266,7 @@ namespace scene UpdateDeltaTime(); //camera.Move(window); update_hand_detection(); + if (!calibrated) return; main_character->Move(regions); if (!main_character.get()->GetOnCollide()) { @@ -295,8 +297,6 @@ namespace scene collision::CheckCollisions(collision_entities); collision_entities.pop_front(); - - update_hand_detection(); } //manages the key input in the game scene @@ -334,6 +334,7 @@ namespace scene void scene::In_Game_Scene::OnSkinCalibrationCallback() { + calibrated = true; std::cout << "on skin calibration callback" << std::endl; std::vector tresholds = reg_left.CalculateSkinTresholds(); reg_right.setSkinTresholds(tresholds);