[ADD] only playing after calibrating
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#include "hand_detect_region.h"
|
#include "hand_detect_region.h"
|
||||||
#define TIME_DURATION 1.5f
|
#define TIME_DURATION 1.0f
|
||||||
namespace computervision
|
namespace computervision
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ namespace entities
|
|||||||
|
|
||||||
const glm::vec3 size = bounding_box.size;
|
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) };
|
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) };
|
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;
|
// 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 };
|
// max_xyz = { bounding_box.center_pos.x + size.x, bounding_box.center_pos.y + size.y, bounding_box.center_pos.z + size.z };
|
||||||
|
|||||||
@@ -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);
|
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 };
|
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<CollisionEntity>(model, model_pos, glm::vec3(0, -90, 0), HOUSE_SIZE, model_box));
|
furniture_list->push_back(std::make_shared<CollisionEntity>(model, model_pos, glm::vec3(0, -90, 0), HOUSE_SIZE, model_box));
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace scene
|
|||||||
int furniture_count_old;
|
int furniture_count_old;
|
||||||
int score;
|
int score;
|
||||||
int* ptr;
|
int* ptr;
|
||||||
|
bool calibrated = false;
|
||||||
|
|
||||||
float delta_time = 0;
|
float delta_time = 0;
|
||||||
|
|
||||||
@@ -112,7 +113,7 @@ namespace scene
|
|||||||
for (int i = 0; i < furniture_count; i++)
|
for (int i = 0; i < furniture_count; i++)
|
||||||
{
|
{
|
||||||
house_models.pop_front();
|
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
|
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();
|
UpdateDeltaTime();
|
||||||
//camera.Move(window);
|
//camera.Move(window);
|
||||||
update_hand_detection();
|
update_hand_detection();
|
||||||
|
if (!calibrated) return;
|
||||||
main_character->Move(regions);
|
main_character->Move(regions);
|
||||||
if (!main_character.get()->GetOnCollide())
|
if (!main_character.get()->GetOnCollide())
|
||||||
{
|
{
|
||||||
@@ -295,8 +297,6 @@ namespace scene
|
|||||||
|
|
||||||
collision::CheckCollisions(collision_entities);
|
collision::CheckCollisions(collision_entities);
|
||||||
collision_entities.pop_front();
|
collision_entities.pop_front();
|
||||||
|
|
||||||
update_hand_detection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//manages the key input in the game scene
|
//manages the key input in the game scene
|
||||||
@@ -334,6 +334,7 @@ namespace scene
|
|||||||
|
|
||||||
void scene::In_Game_Scene::OnSkinCalibrationCallback()
|
void scene::In_Game_Scene::OnSkinCalibrationCallback()
|
||||||
{
|
{
|
||||||
|
calibrated = true;
|
||||||
std::cout << "on skin calibration callback" << std::endl;
|
std::cout << "on skin calibration callback" << std::endl;
|
||||||
std::vector<int> tresholds = reg_left.CalculateSkinTresholds();
|
std::vector<int> tresholds = reg_left.CalculateSkinTresholds();
|
||||||
reg_right.setSkinTresholds(tresholds);
|
reg_right.setSkinTresholds(tresholds);
|
||||||
|
|||||||
Reference in New Issue
Block a user