Made the hurt hazard work better.

This commit is contained in:
2023-04-01 23:52:34 -07:00
parent 9167c7a88a
commit fdb1c69775
17 changed files with 141 additions and 68 deletions

View File

@ -85,15 +85,13 @@ bool_t Dawn::boxIsBoxColliding(
glm::vec2 posB, glm::vec2 minB, glm::vec2 maxB
) {
// Check for no overlap in X axis
if (posA.x + maxA.x < posB.x + minB.x || posA.x + minA.x > posB.x + maxB.x) {
if (posA.x + maxA.x < posB.x + minB.x || posB.x + maxB.x < posA.x + minA.x) {
return false;
}
// Check for no overlap in Y axis
if (posA.y + maxA.y < posB.y + minB.y || posA.y + minA.y > posB.y + maxB.y) {
if (posA.y + maxA.y < posB.y + minB.y || posB.y + maxB.y < posA.y + minA.y) {
return false;
}
// There is overlap in both X and Y axis, so the boxes are colliding
return true;
}

View File

@ -0,0 +1,13 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
namespace Dawn {
static inline glm::vec2 physics3Dto2D(glm::vec3 v) {
return glm::vec2(v.x, v.z);
}
}