Commit c319169f authored by Benjamin Castel's avatar Benjamin Castel
Browse files

feat: Cleaned collision (taking velocity in account now)

parent 9a5a33e3
Loading
Loading
Loading
Loading
+1 −0
Changes for include/model/Entity.hpp: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ class Entity {
        glm::quat get_rotation() const;

        glm::vec3 get_position() const;
        virtual glm::vec3 get_velocity() const;

        void move(glm::vec3 translation);
        void rotate(glm::quat rotation);
+4 −2
Changes for src/model/Entity.cpp: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ bool Entity::check_box_intersection(const std::unique_ptr<RenderObject> &renderO
        boxDimsOther.z * other.m_scale.z
    };

    std::array<glm::vec3, 8> verticesThis {
    /*std::array<glm::vec3, 8> verticesThis {
        centerThis + extentsThis[0]*axisThis[0] + extentsThis[1]*axisThis[1] + extentsThis[2]*axisThis[2],
        centerThis - extentsThis[0]*axisThis[0] + extentsThis[1]*axisThis[1] + extentsThis[2]*axisThis[2],
        centerThis + extentsThis[0]*axisThis[0] - extentsThis[1]*axisThis[1] + extentsThis[2]*axisThis[2],
@@ -133,7 +133,7 @@ bool Entity::check_box_intersection(const std::unique_ptr<RenderObject> &renderO
        centerOther - extentsOther[0]*axisOther[0] + extentsOther[1]*axisOther[1] - extentsOther[2]*axisOther[2],
        centerOther + extentsOther[0]*axisOther[0] - extentsOther[1]*axisOther[1] - extentsOther[2]*axisOther[2],
        centerOther - extentsOther[0]*axisOther[0] - extentsOther[1]*axisOther[1] - extentsOther[2]*axisOther[2]
    };
    };*/

    glm::mat3 cMatrix {
        {glm::dot(axisThis[0], axisOther[0]), glm::dot(axisThis[0], axisOther[1]), glm::dot(axisThis[0], axisOther[2])},
@@ -256,3 +256,5 @@ glm::vec3 Entity::get_z_axis() const { return this->m_localZ; }
glm::vec3 Entity::get_position() const { return this->m_position; }

glm::quat Entity::get_rotation() const { return this->m_rotation; }

glm::vec3 Entity::get_velocity() const { return glm::vec3(0); }