]> git.localhorst.tv Git - blank.git/blobdiff - src/ui/ui.cpp
entity/world collision response
[blank.git] / src / ui / ui.cpp
index 410072da681ed292042949fb88247bd409160068..ea9786b0382952c4aea69a5ac29b1cd0e7d8ed00 100644 (file)
@@ -128,6 +128,10 @@ void Interface::HandlePress(const SDL_KeyboardEvent &event) {
                        TurnBlock();
                        break;
 
+               case SDLK_n:
+                       ToggleCollision();
+                       break;
+
                case SDLK_b:
                        PrintBlockInfo();
                        break;
@@ -178,6 +182,11 @@ void Interface::TurnBlock() {
        hud.Display(selection);
 }
 
+void Interface::ToggleCollision() {
+       ctrl.Controlled().WorldCollidable(!ctrl.Controlled().WorldCollidable());
+       std::cout << "collision " << (ctrl.Controlled().WorldCollidable() ? "on" : "off") << std::endl;
+}
+
 void Interface::PrintBlockInfo() {
        std::cout << std::endl;
        if (!aim_chunk) {
@@ -356,7 +365,7 @@ void Interface::Update(int dt) {
 
 void Interface::CheckAim() {
        float dist;
-       if (world.Intersection(aim, glm::mat4(1.0f), &aim_chunk, &aim_block, &dist, &aim_normal)) {
+       if (world.Intersection(aim, glm::mat4(1.0f), aim_chunk, aim_block, dist, aim_normal)) {
                outline.Clear();
                aim_chunk->Type(aim_chunk->BlockAt(aim_block)).FillOutlineModel(outline);
                outline_transform = glm::scale(glm::vec3(1.0002f));